From 20577d184c030a23a6b384b8570f583bb32f14d2 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 25 Apr 2026 15:24:42 +0200 Subject: wf-recorder --- .../shell/quickshell/Services/ScreenRecord.qml | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 accounts/gkleen@sif/shell/quickshell/Services/ScreenRecord.qml (limited to 'accounts/gkleen@sif/shell/quickshell/Services') diff --git a/accounts/gkleen@sif/shell/quickshell/Services/ScreenRecord.qml b/accounts/gkleen@sif/shell/quickshell/Services/ScreenRecord.qml new file mode 100644 index 00000000..eb415452 --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/Services/ScreenRecord.qml @@ -0,0 +1,63 @@ +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; + } + } +} -- cgit v1.2.3