summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/Services
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/Services')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/Services/ScreenRecord.qml63
1 files changed, 63 insertions, 0 deletions
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 @@
1pragma Singleton
2
3import Quickshell
4import Quickshell.Io
5
6Singleton {
7 id: root
8 property bool active: false
9 property bool slurpSuccess: false
10
11 onActiveChanged: {
12 if (!active) {
13 slurp.running = false;
14 screenRecorder.running = false;
15 }
16 if (active)
17 slurp.running = true;
18 }
19
20 Process {
21 id: screenRecorder
22 running: false
23 onRunningChanged: {
24 console.log("wf-recorder running: ", screenRecorder.running);
25
26 if (!screenRecorder.running && !slurp.running)
27 root.active = false;
28 }
29 stderr: SplitParser {
30 onRead: line => console.log("wf-recorder stderr: ", line)
31 }
32 stdout: SplitParser {
33 onRead: line => console.log("wf-recorder stdout: ", line)
34 }
35 }
36
37 Process {
38 id: slurp
39 running: false
40 command: [ @slurp@, "-o", "-d" ]
41 stdout: StdioCollector {}
42 stderr: SplitParser {
43 onRead: line => console.log("slurp stderr: ", line)
44 }
45 onExited: exitCode => {
46 if (exitCode !== 0) {
47 console.log("slurp failed: ", exitCode);
48 root.active = false;
49 return;
50 }
51 console.log("slurp succeeded: ", slurp.stdout.text);
52
53 const nowDate = new Date();
54
55 screenRecorder.command = [
56 @wf-recorder@,
57 "-g", slurp.stdout.text,
58 "-f", `${Quickshell.env("HOME")}/screenshots/${nowDate.toLocaleString(Qt.locale(), "yyyy-MM-ddThh:mm:ss")}.mkv`,
59 ];
60 screenRecorder.running = true;
61 }
62 }
63}