summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--overlays/quickshell/close-stdin.patch13
-rw-r--r--overlays/quickshell/default.nix1
6 files changed, 89 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}
diff --git a/overlays/quickshell/close-stdin.patch b/overlays/quickshell/close-stdin.patch
new file mode 100644
index 00000000..230c602c
--- /dev/null
+++ b/overlays/quickshell/close-stdin.patch
@@ -0,0 +1,13 @@
1diff --git i/src/io/process.cpp w/src/io/process.cpp
2index 6055e2c..f528438 100644
3--- i/src/io/process.cpp
4+++ w/src/io/process.cpp
5@@ -210,7 +210,7 @@ void Process::startProcessIfReady() {
6
7 if (this->mStdoutParser == nullptr) this->process->closeReadChannel(QProcess::StandardOutput);
8 if (this->mStderrParser == nullptr) this->process->closeReadChannel(QProcess::StandardError);
9- if (!this->mStdinEnabled) this->process->closeWriteChannel();
10+ if (!this->mStdinEnabled) this->process->setStandardInputFile(QProcess::nullDevice());
11
12 this->setupEnvironment(this->process);
13 this->process->start(cmd, args);
diff --git a/overlays/quickshell/default.nix b/overlays/quickshell/default.nix
index 942eb931..9aefeeb4 100644
--- a/overlays/quickshell/default.nix
+++ b/overlays/quickshell/default.nix
@@ -19,6 +19,7 @@
19 ./lock-state-changed.patch 19 ./lock-state-changed.patch
20 ./pipewire.patch 20 ./pipewire.patch
21 ./io.patch 21 ./io.patch
22 ./close-stdin.patch
22 ]; 23 ];
23 }); 24 });
24} 25}