1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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;
}
}
}
|