summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/UnixIPC.qml')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/UnixIPC.qml18
1 files changed, 18 insertions, 0 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml b/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml
index 742ef4f5..e7b7b673 100644
--- a/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml
+++ b/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml
@@ -1,7 +1,9 @@
1import Quickshell 1import Quickshell
2import Quickshell.Io 2import Quickshell.Io
3import Quickshell.Services.Pipewire 3import Quickshell.Services.Pipewire
4import Quickshell.Services.Mpris
4import qs.Services 5import qs.Services
6import Custom as Custom
5 7
6Scope { 8Scope {
7 id: root 9 id: root
@@ -19,6 +21,14 @@ Scope {
19 root.onCommandVolume(command.Volume); 21 root.onCommandVolume(command.Volume);
20 else if (command.Brightness) 22 else if (command.Brightness)
21 root.onCommandBrightness(command.Brightness); 23 root.onCommandBrightness(command.Brightness);
24 else if (command.LockSession)
25 Custom.Systemd.lockSession();
26 else if (command.Suspend)
27 Custom.Systemd.suspend();
28 else if (command.Hibernate)
29 Custom.Systemd.hibernate();
30 else if (command.Mpris)
31 root.onCommandMpris(command.Mpris);
22 else 32 else
23 console.warn("UnixIPC: Command not handled:", JSON.stringify(command)); 33 console.warn("UnixIPC: Command not handled:", JSON.stringify(command));
24 } catch (e) { 34 } catch (e) {
@@ -56,4 +66,12 @@ Scope {
56 if (command === "down") 66 if (command === "down")
57 Brightness.currBrightness -= 0.02 67 Brightness.currBrightness -= 0.02
58 } 68 }
69
70 function onCommandMpris(command) {
71 if (command.PauseAll)
72 Array.from(MprisProxy.players).forEach(player => {
73 if (player.canPause && player.isPlaying)
74 player.pause();
75 });
76 }
59} 77}