summaryrefslogtreecommitdiff
path: root/accounts
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2026-04-25 15:24:42 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2026-04-25 15:24:42 +0200
commit20577d184c030a23a6b384b8570f583bb32f14d2 (patch)
treebfb7fc21d27f31218b838ede80795f525b1952fd /accounts
parent395ca23e9599460cdfa91c34ae52296edf7cfd41 (diff)
downloadnixos-20577d184c030a23a6b384b8570f583bb32f14d2.tar
nixos-20577d184c030a23a6b384b8570f583bb32f14d2.tar.gz
nixos-20577d184c030a23a6b384b8570f583bb32f14d2.tar.bz2
nixos-20577d184c030a23a6b384b8570f583bb32f14d2.tar.xz
nixos-20577d184c030a23a6b384b8570f583bb32f14d2.zip
wf-recorderflakes
Diffstat (limited to 'accounts')
-rw-r--r--accounts/gkleen@sif/niri.nix1
-rw-r--r--accounts/gkleen@sif/shell/default.nix2
-rw-r--r--accounts/gkleen@sif/shell/quickshell/Services/ScreenRecord.qml63
-rw-r--r--accounts/gkleen@sif/shell/quickshell/UnixIPC.qml9
4 files changed, 75 insertions, 0 deletions
diff --git a/accounts/gkleen@sif/niri.nix b/accounts/gkleen@sif/niri.nix
index 098386d0..b30c5701 100644
--- a/accounts/gkleen@sif/niri.nix
+++ b/accounts/gkleen@sif/niri.nix
@@ -994,6 +994,7 @@ in {
994 }; 994 };
995 "Mod+Semicolon".action = shell { Notifications = { DismissGroup = {}; }; }; 995 "Mod+Semicolon".action = shell { Notifications = { DismissGroup = {}; }; };
996 "Mod+Shift+Semicolon".action = shell { Notifications = { DismissAll = {}; }; }; 996 "Mod+Shift+Semicolon".action = shell { Notifications = { DismissAll = {}; }; };
997 "Mod+Print".action = shell { ScreenRecord = { Toggle = {}; }; };
997 })) 998 }))
998 (map ({ name, selector, spawn, key, ...}: if key != null && selector != null && spawn != null then bind key { action = focus-or-spawn-action selector name spawn; } else null) cfg.scratchspaces) 999 (map ({ name, selector, spawn, key, ...}: if key != null && selector != null && spawn != null then bind key { action = focus-or-spawn-action selector name spawn; } else null) cfg.scratchspaces)
999 (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = move-column-to-workspace name; } else null) cfg.scratchspaces) 1000 (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = move-column-to-workspace name; } else null) cfg.scratchspaces)
diff --git a/accounts/gkleen@sif/shell/default.nix b/accounts/gkleen@sif/shell/default.nix
index 18cec3fd..09eb6863 100644
--- a/accounts/gkleen@sif/shell/default.nix
+++ b/accounts/gkleen@sif/shell/default.nix
@@ -109,6 +109,8 @@
109 hash = "sha256-QMGl7soAhErrrnY3aKOZpt49yebkSNzy10p/v5OaqQ0="; 109 hash = "sha256-QMGl7soAhErrrnY3aKOZpt49yebkSNzy10p/v5OaqQ0=";
110 }); 110 });
111 worktime = builtins.toJSON (lib.getExe pkgs.worktime); 111 worktime = builtins.toJSON (lib.getExe pkgs.worktime);
112 slurp = builtins.toJSON (lib.getExe pkgs.slurp);
113 wf-recorder = builtins.toJSON (lib.getExe pkgs.wf-recorder);
112 }; 114 };
113 }; 115 };
114 }; 116 };
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}
diff --git a/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml b/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml
index 05a40dbc..3d950031 100644
--- a/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml
+++ b/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml
@@ -39,6 +39,8 @@ Scope {
39 root.onCommandMpris(command.Mpris); 39 root.onCommandMpris(command.Mpris);
40 else if (command.Notifications) 40 else if (command.Notifications)
41 root.onCommandNotifications(command.Notifications); 41 root.onCommandNotifications(command.Notifications);
42 else if (command.ScreenRecord)
43 root.onCommandScreenRecord(command.ScreenRecord);
42 else 44 else
43 console.warn("UnixIPC: Command not handled:", JSON.stringify(command)); 45 console.warn("UnixIPC: Command not handled:", JSON.stringify(command));
44 } 46 }
@@ -94,4 +96,11 @@ Scope {
94 notif.dismiss(); 96 notif.dismiss();
95 } 97 }
96 } 98 }
99
100 function onCommandScreenRecord(command) {
101 if (command.Toggle)
102 ScreenRecord.active = !ScreenRecord.active;
103 else
104 console.warn("UnixIPC.ScreenRecord: Command not handled:", JSON.stringify(command));
105 }
97} 106}