pragma Singleton import Quickshell import Quickshell.Io Singleton { id: root property bool active: false property bool slurpSuccess: false onActiveChanged: { if (!active) { slurp.running = false; screenRecorder.running = false; } if (active) slurp.running = true; } Process { id: screenRecorder running: false onRunningChanged: { console.log("wf-recorder running: ", screenRecorder.running); if (!screenRecorder.running && !slurp.running) root.active = false; } stderr: SplitParser { onRead: line => console.log("wf-recorder stderr: ", line) } stdout: SplitParser { onRead: line => console.log("wf-recorder stdout: ", line) } } Process { id: slurp running: false command: [ @slurp@, "-o", "-d" ] stdout: StdioCollector {} stderr: SplitParser { onRead: line => console.log("slurp stderr: ", line) } onExited: exitCode => { if (exitCode !== 0) { console.log("slurp failed: ", exitCode); root.active = false; return; } console.log("slurp succeeded: ", slurp.stdout.text); const nowDate = new Date(); screenRecorder.command = [ @wf-recorder@, "-g", slurp.stdout.text, "-f", `${Quickshell.env("HOME")}/screenshots/${nowDate.toLocaleString(Qt.locale(), "yyyy-MM-ddThh:mm:ss")}.mkv`, ]; screenRecorder.running = true; } } }