summaryrefslogtreecommitdiff
path: root/services/Recorder.qml
diff options
context:
space:
mode:
Diffstat (limited to 'services/Recorder.qml')
-rw-r--r--services/Recorder.qml38
1 files changed, 38 insertions, 0 deletions
diff --git a/services/Recorder.qml b/services/Recorder.qml
new file mode 100644
index 0000000..370bfd8
--- /dev/null
+++ b/services/Recorder.qml
@@ -0,0 +1,38 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Io
+
+Singleton {
+ id: root
+
+ readonly property alias running: props.running
+ readonly property alias paused: props.paused
+
+ function toggle(): void {
+ Quickshell.execDetached(["caelestia", "record"]);
+ props.running = !props.running;
+ if (!props.running)
+ props.paused = false;
+ }
+
+ function togglePause(): void {
+ Quickshell.execDetached(["caelestia", "record", "-p"]);
+ props.paused = !props.paused;
+ }
+
+ PersistentProperties {
+ id: props
+
+ property bool running: false
+ property bool paused: false
+
+ reloadableId: "recorder"
+ }
+
+ Process {
+ running: true
+ command: ["pidof", "gpu-screen-recorder"]
+ onExited: code => props.running = code === 0
+ }
+}