aurora187d87f
aurora: record desktop audio (default sink monitor)
+7 −3
1 file changed
| @@ -3,8 +3,10 @@ import QtQuick | |||
| 3 | 3 | import Quickshell | |
| 4 | 4 | import Quickshell.Io | |
| 5 | 5 | import Quickshell.Hyprland | |
| 6 | + | import Quickshell.Services.Pipewire | |
| 6 | 7 | ||
| 7 | − | // Screen recording with wf-recorder (region via slurp, or the focused monitor), saved to ~/vids/rec. | |
| 8 | + | // Screen recording with wf-recorder (the focused monitor, or a region via slurp), saved to ~/vids/rec. | |
| 9 | + | // Records desktop audio: the monitor source of the current default output (whatever you hear). | |
| 8 | 10 | // Two steps so each can be cancelled: `selecting` (slurp is up) then `running` (wf-recorder records). | |
| 9 | 11 | // stop() works in both. Everything is hidden if wf-recorder / slurp aren't installed. | |
| 10 | 12 | Singleton { | |
| @@ -36,8 +38,10 @@ Singleton { | |||
| 36 | 38 | var mon = Hyprland.focusedMonitor | |
| 37 | 39 | // exec so the Process pid is wf-recorder itself and SIGINT reaches it. | |
| 38 | 40 | // its (very chatty) output must go to a file: left on the Process pipe it dies without writing anything | |
| 39 | − | var run = 'mkdir -p "${1%/*}" "${3%/*}"; exec wf-recorder ' + (geometry !== "" ? '-g' : '-o') + ' "$2" -f "$1" >"$3" 2>&1' | |
| 40 | − | recProc.command = ["sh", "-c", run, "sh", file, geometry !== "" ? geometry : (mon ? mon.name : ""), log] | |
| 41 | + | var sink = Pipewire.defaultAudioSink | |
| 42 | + | var audio = sink ? "--audio=" + sink.name + ".monitor" : "--audio" | |
| 43 | + | var run = 'mkdir -p "${1%/*}" "${3%/*}"; exec wf-recorder ' + (geometry !== "" ? '-g' : '-o') + ' "$2" "$4" -f "$1" >"$3" 2>&1' | |
| 44 | + | recProc.command = ["sh", "-c", run, "sh", file, geometry !== "" ? geometry : (mon ? mon.name : ""), log, audio] | |
| 41 | 45 | elapsed = 0 | |
| 42 | 46 | recProc.running = true | |
| 43 | 47 | } | |