diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-09 21:40:07 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-09 21:40:07 +0200 |
commit | 9fab3828698199718a3d2f2faf8826f77d9258f7 (patch) | |
tree | 6e6d567a3877b425bdd0329e898cd00013c766fb | |
parent | df1632d1c15cba4b7a361f8159b9988919ef8277 (diff) | |
download | nixos-9fab3828698199718a3d2f2faf8826f77d9258f7.tar nixos-9fab3828698199718a3d2f2faf8826f77d9258f7.tar.gz nixos-9fab3828698199718a3d2f2faf8826f77d9258f7.tar.bz2 nixos-9fab3828698199718a3d2f2faf8826f77d9258f7.tar.xz nixos-9fab3828698199718a3d2f2faf8826f77d9258f7.zip |
...quickshell
-rw-r--r-- | accounts/gkleen@sif/niri/default.nix | 39 | ||||
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/UnixIPC.qml | 49 | ||||
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml | 55 | ||||
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/shell.qml | 2 | ||||
-rw-r--r-- | flake.lock | 45 | ||||
-rw-r--r-- | flake.nix | 7 | ||||
-rw-r--r-- | overlays/niri.nix | 1 | ||||
-rw-r--r-- | overlays/quickshell/default.nix | 1 | ||||
-rw-r--r-- | overlays/quickshell/io.patch | 13 |
9 files changed, 159 insertions, 53 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix index e1eca4c4..1ff149bc 100644 --- a/accounts/gkleen@sif/niri/default.nix +++ b/accounts/gkleen@sif/niri/default.nix | |||
@@ -947,22 +947,6 @@ in { | |||
947 | action = spawn swayosd-client "--brightness" "lower"; | 947 | action = spawn swayosd-client "--brightness" "lower"; |
948 | allow-when-locked = true; | 948 | allow-when-locked = true; |
949 | }; | 949 | }; |
950 | "XF86AudioRaiseVolume" = { | ||
951 | action = spawn swayosd-client "--output-volume" "raise"; | ||
952 | allow-when-locked = true; | ||
953 | }; | ||
954 | "XF86AudioLowerVolume" = { | ||
955 | action = spawn swayosd-client "--output-volume" "lower"; | ||
956 | allow-when-locked = true; | ||
957 | }; | ||
958 | "XF86AudioMute" = { | ||
959 | action = spawn swayosd-client "--output-volume" "mute-toggle"; | ||
960 | allow-when-locked = true; | ||
961 | }; | ||
962 | "XF86AudioMicMute" = { | ||
963 | action = spawn swayosd-client "--input-volume" "mute-toggle"; | ||
964 | allow-when-locked = true; | ||
965 | }; | ||
966 | 950 | ||
967 | "Mod+Semicolon".action = spawn makoctl "dismiss" "--group"; | 951 | "Mod+Semicolon".action = spawn makoctl "dismiss" "--group"; |
968 | "Mod+Shift+Semicolon".action = spawn makoctl "dismiss" "--all"; | 952 | "Mod+Shift+Semicolon".action = spawn makoctl "dismiss" "--all"; |
@@ -982,6 +966,29 @@ in { | |||
982 | "Mod+K".action = spawn (lib.getExe' pkgs.worktime "worktime-ui"); | 966 | "Mod+K".action = spawn (lib.getExe' pkgs.worktime "worktime-ui"); |
983 | "Mod+Shift+K".action = spawn (lib.getExe' pkgs.worktime "worktime-stop"); | 967 | "Mod+Shift+K".action = spawn (lib.getExe' pkgs.worktime "worktime-stop"); |
984 | })) | 968 | })) |
969 | (lib.mapAttrsToList (name: cfg: node name [(lib.removeAttrs cfg ["action"])] [cfg.action]) (let | ||
970 | shell = obj: leaf "send-unix" [ | ||
971 | { path = ''''${XDG_RUNTIME_DIR}/shell.sock''; } | ||
972 | (builtins.toJSON obj + "\n") | ||
973 | ]; | ||
974 | in { | ||
975 | "XF86AudioRaiseVolume" = { | ||
976 | allow-when-locked = true; | ||
977 | action = shell { Volume.volume = "up"; }; | ||
978 | }; | ||
979 | "XF86AudioLowerVolume" = { | ||
980 | allow-when-locked = true; | ||
981 | action = shell { Volume.volume = "down"; }; | ||
982 | }; | ||
983 | "XF86AudioMute" = { | ||
984 | allow-when-locked = true; | ||
985 | action = shell { Volume.muted = "toggle"; }; | ||
986 | }; | ||
987 | "XF86AudioMicMute" = { | ||
988 | allow-when-locked = true; | ||
989 | action = shell { Volume."mic-muted" = "toggle"; }; | ||
990 | }; | ||
991 | })) | ||
985 | (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) | 992 | (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) |
986 | (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces) | 993 | (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces) |
987 | ] | 994 | ] |
diff --git a/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml b/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml new file mode 100644 index 00000000..7b308ec0 --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/UnixIPC.qml | |||
@@ -0,0 +1,49 @@ | |||
1 | import Quickshell | ||
2 | import Quickshell.Io | ||
3 | import Quickshell.Services.Pipewire | ||
4 | |||
5 | Scope { | ||
6 | id: root | ||
7 | |||
8 | SocketServer { | ||
9 | active: true | ||
10 | path: `${Quickshell.env("XDG_RUNTIME_DIR")}/shell.sock` | ||
11 | handler: Socket { | ||
12 | parser: SplitParser { | ||
13 | onRead: line => { | ||
14 | try { | ||
15 | const command = JSON.parse(line); | ||
16 | |||
17 | if (command.Volume) | ||
18 | root.onCommandVolume(command.Volume); | ||
19 | else | ||
20 | console.warn("UnixIPC: Command not handled:", JSON.stringify(command)); | ||
21 | } catch (e) { | ||
22 | console.warn("UnixIPC: Failed to parse command:", line, e); | ||
23 | } | ||
24 | } | ||
25 | } | ||
26 | |||
27 | onError: e => { | ||
28 | if (e == 1) | ||
29 | return; | ||
30 | console.warn("QLocalSocket::LocalSocketError", e); | ||
31 | } | ||
32 | } | ||
33 | } | ||
34 | |||
35 | PwObjectTracker { | ||
36 | objects: [ Pipewire.defaultAudioSink, Pipewire.defaultAudioSource ] | ||
37 | } | ||
38 | function onCommandVolume(command) { | ||
39 | if (command.muted === "toggle") | ||
40 | Pipewire.defaultAudioSink.audio.muted = !Pipewire.defaultAudioSink.audio.muted; | ||
41 | if (command.volume === "up") | ||
42 | Pipewire.defaultAudioSink.audio.volume += 0.02; | ||
43 | if (command.volume === "down") | ||
44 | Pipewire.defaultAudioSink.audio.volume -= 0.02; | ||
45 | |||
46 | if (command["mic-muted"] === "toggle") | ||
47 | Pipewire.defaultAudioSource.audio.muted = !Pipewire.defaultAudioSource.audio.muted; | ||
48 | } | ||
49 | } | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml b/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml index 02dcf227..16fb5dea 100644 --- a/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml +++ b/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml | |||
@@ -7,11 +7,11 @@ import Quickshell.Widgets | |||
7 | Scope { | 7 | Scope { |
8 | id: root | 8 | id: root |
9 | 9 | ||
10 | property bool show: false | 10 | property string show: "" |
11 | property bool inhibited: true | 11 | property bool inhibited: true |
12 | 12 | ||
13 | PwObjectTracker { | 13 | PwObjectTracker { |
14 | objects: [ Pipewire.defaultAudioSink ] | 14 | objects: [ Pipewire.defaultAudioSink, Pipewire.defaultAudioSource ] |
15 | } | 15 | } |
16 | 16 | ||
17 | Connections { | 17 | Connections { |
@@ -19,11 +19,25 @@ Scope { | |||
19 | target: Pipewire.defaultAudioSink?.audio | 19 | target: Pipewire.defaultAudioSink?.audio |
20 | 20 | ||
21 | function onVolumeChanged() { | 21 | function onVolumeChanged() { |
22 | root.show = true; | 22 | root.show = "sink"; |
23 | hideTimer.restart(); | 23 | hideTimer.restart(); |
24 | } | 24 | } |
25 | function onMutedChanged() { | 25 | function onMutedChanged() { |
26 | root.show = true; | 26 | root.show = "sink"; |
27 | hideTimer.restart(); | ||
28 | } | ||
29 | } | ||
30 | |||
31 | Connections { | ||
32 | enabled: Pipewire.defaultAudioSource | ||
33 | target: Pipewire.defaultAudioSource?.audio | ||
34 | |||
35 | function onVolumeChanged() { | ||
36 | root.show = "source"; | ||
37 | hideTimer.restart(); | ||
38 | } | ||
39 | function onMutedChanged() { | ||
40 | root.show = "source"; | ||
27 | hideTimer.restart(); | 41 | hideTimer.restart(); |
28 | } | 42 | } |
29 | } | 43 | } |
@@ -36,7 +50,7 @@ Scope { | |||
36 | Timer { | 50 | Timer { |
37 | id: hideTimer | 51 | id: hideTimer |
38 | interval: 1000 | 52 | interval: 1000 |
39 | onTriggered: root.show = false | 53 | onTriggered: root.show = "" |
40 | } | 54 | } |
41 | 55 | ||
42 | Timer { | 56 | Timer { |
@@ -44,7 +58,7 @@ Scope { | |||
44 | interval: 100 | 58 | interval: 100 |
45 | running: true | 59 | running: true |
46 | onTriggered: { | 60 | onTriggered: { |
47 | root.show = false; | 61 | root.show = ""; |
48 | root.inhibited = false; | 62 | root.inhibited = false; |
49 | } | 63 | } |
50 | } | 64 | } |
@@ -97,13 +111,20 @@ Scope { | |||
97 | implicitHeight: parent.height | 111 | implicitHeight: parent.height |
98 | 112 | ||
99 | icon: { | 113 | icon: { |
100 | if (!Pipewire.defaultAudioSink || Pipewire.defaultAudioSink.audio.muted) | 114 | if (root.show == "sink") { |
101 | return "volume-off"; | 115 | if (!Pipewire.defaultAudioSink || Pipewire.defaultAudioSink.audio.muted) |
102 | if (Pipewire.defaultAudioSink.audio.volume <= 0.33) | 116 | return "volume-off"; |
103 | return "volume-low"; | 117 | if (Pipewire.defaultAudioSink.audio.volume <= 0.33) |
104 | if (Pipewire.defaultAudioSink.audio.volume <= 0.67) | 118 | return "volume-low"; |
105 | return "volume-medium"; | 119 | if (Pipewire.defaultAudioSink.audio.volume <= 0.67) |
106 | return "volume-high"; | 120 | return "volume-medium"; |
121 | return "volume-high"; | ||
122 | } else if (root.show == "source") { | ||
123 | if (!Pipewire.defaultAudioSource || Pipewire.defaultAudioSource.audio.muted) | ||
124 | return "microphone-off"; | ||
125 | return "microphone"; | ||
126 | } | ||
127 | return "volume-high"; | ||
107 | } | 128 | } |
108 | } | 129 | } |
109 | 130 | ||
@@ -123,7 +144,13 @@ Scope { | |||
123 | 144 | ||
124 | color: Pipewire.defaultAudioSink?.audio.muted ? "#70ffffff" : "white" | 145 | color: Pipewire.defaultAudioSink?.audio.muted ? "#70ffffff" : "white" |
125 | 146 | ||
126 | implicitWidth: parent.width * (Pipewire.defaultAudioSink?.audio.volume ?? 0) | 147 | implicitWidth: { |
148 | if (root.show == "sink") | ||
149 | return parent.width * (Pipewire.defaultAudioSink?.audio.volume ?? 0); | ||
150 | else if (root.show == "source") | ||
151 | return parent.width * (Pipewire.defaultAudioSource?.audio.volume ?? 0); | ||
152 | return 0; | ||
153 | } | ||
127 | } | 154 | } |
128 | } | 155 | } |
129 | } | 156 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/shell.qml b/accounts/gkleen@sif/shell/quickshell/shell.qml index 3657f77f..3bb2ae00 100644 --- a/accounts/gkleen@sif/shell/quickshell/shell.qml +++ b/accounts/gkleen@sif/shell/quickshell/shell.qml | |||
@@ -43,4 +43,6 @@ ShellRoot { | |||
43 | Lockscreen {} | 43 | Lockscreen {} |
44 | 44 | ||
45 | VolumeOSD {} | 45 | VolumeOSD {} |
46 | |||
47 | UnixIPC {} | ||
46 | } | 48 | } |
@@ -507,11 +507,11 @@ | |||
507 | "xwayland-satellite-unstable": "xwayland-satellite-unstable" | 507 | "xwayland-satellite-unstable": "xwayland-satellite-unstable" |
508 | }, | 508 | }, |
509 | "locked": { | 509 | "locked": { |
510 | "lastModified": 1755424351, | 510 | "lastModified": 1757437545, |
511 | "narHash": "sha256-xcorYLNdtLpb0wH5CPlUcpmYQUxeK95j1X855xQw+DY=", | 511 | "narHash": "sha256-7ssbrFnmSrqtCtOySiu5ncyOBxPrR6p2nhNHrg6D+fo=", |
512 | "owner": "sodiboo", | 512 | "owner": "sodiboo", |
513 | "repo": "niri-flake", | 513 | "repo": "niri-flake", |
514 | "rev": "9aa137af01f05386e5bb5050e983750017007a66", | 514 | "rev": "ef694b996daeeb8684c0adfaa9b7067a6e709054", |
515 | "type": "github" | 515 | "type": "github" |
516 | }, | 516 | }, |
517 | "original": { | 517 | "original": { |
@@ -524,16 +524,16 @@ | |||
524 | "niri-stable": { | 524 | "niri-stable": { |
525 | "flake": false, | 525 | "flake": false, |
526 | "locked": { | 526 | "locked": { |
527 | "lastModified": 1748151941, | 527 | "lastModified": 1756556321, |
528 | "narHash": "sha256-z4viQZLgC2bIJ3VrzQnR+q2F3gAOEQpU1H5xHtX/2fs=", | 528 | "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=", |
529 | "owner": "YaLTeR", | 529 | "owner": "YaLTeR", |
530 | "repo": "niri", | 530 | "repo": "niri", |
531 | "rev": "8ba57fcf25d2fc9565131684a839d58703f1dae7", | 531 | "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294", |
532 | "type": "github" | 532 | "type": "github" |
533 | }, | 533 | }, |
534 | "original": { | 534 | "original": { |
535 | "owner": "YaLTeR", | 535 | "owner": "YaLTeR", |
536 | "ref": "v25.05.1", | 536 | "ref": "v25.08", |
537 | "repo": "niri", | 537 | "repo": "niri", |
538 | "type": "github" | 538 | "type": "github" |
539 | } | 539 | } |
@@ -541,15 +541,16 @@ | |||
541 | "niri-unstable": { | 541 | "niri-unstable": { |
542 | "flake": false, | 542 | "flake": false, |
543 | "locked": { | 543 | "locked": { |
544 | "lastModified": 1755419373, | 544 | "lastModified": 1757438446, |
545 | "narHash": "sha256-EFH3zbpyLYjEboNV2Lmkxf9joEuFCmeYX+MMLRPStpg=", | 545 | "narHash": "sha256-4NN+weI4isQCFB+A36J+CU8tb251maVlBO9usuzgMQ8=", |
546 | "owner": "YaLTeR", | 546 | "owner": "gkleen", |
547 | "repo": "niri", | 547 | "repo": "niri", |
548 | "rev": "a6febb86aa5af0df7bf2792ca027ef95a503d599", | 548 | "rev": "2c7f7053ce360279160a9e2366d54980def848ad", |
549 | "type": "github" | 549 | "type": "github" |
550 | }, | 550 | }, |
551 | "original": { | 551 | "original": { |
552 | "owner": "YaLTeR", | 552 | "owner": "gkleen", |
553 | "ref": "feat/unix-sockets", | ||
553 | "repo": "niri", | 554 | "repo": "niri", |
554 | "type": "github" | 555 | "type": "github" |
555 | } | 556 | } |
@@ -780,11 +781,11 @@ | |||
780 | }, | 781 | }, |
781 | "nixpkgs-stable_3": { | 782 | "nixpkgs-stable_3": { |
782 | "locked": { | 783 | "locked": { |
783 | "lastModified": 1755274400, | 784 | "lastModified": 1757408970, |
784 | "narHash": "sha256-rTInmnp/xYrfcMZyFMH3kc8oko5zYfxsowaLv1LVobY=", | 785 | "narHash": "sha256-aSgK4BLNFFGvDTNKPeB28lVXYqVn8RdyXDNAvgGq+k0=", |
785 | "owner": "NixOS", | 786 | "owner": "NixOS", |
786 | "repo": "nixpkgs", | 787 | "repo": "nixpkgs", |
787 | "rev": "ad7196ae55c295f53a7d1ec39e4a06d922f3b899", | 788 | "rev": "d179d77c139e0a3f5c416477f7747e9d6b7ec315", |
788 | "type": "github" | 789 | "type": "github" |
789 | }, | 790 | }, |
790 | "original": { | 791 | "original": { |
@@ -1280,16 +1281,16 @@ | |||
1280 | "xwayland-satellite-stable": { | 1281 | "xwayland-satellite-stable": { |
1281 | "flake": false, | 1282 | "flake": false, |
1282 | "locked": { | 1283 | "locked": { |
1283 | "lastModified": 1748488455, | 1284 | "lastModified": 1755491097, |
1284 | "narHash": "sha256-IiLr1alzKFIy5tGGpDlabQbe6LV1c9ABvkH6T5WmyRI=", | 1285 | "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=", |
1285 | "owner": "Supreeeme", | 1286 | "owner": "Supreeeme", |
1286 | "repo": "xwayland-satellite", | 1287 | "repo": "xwayland-satellite", |
1287 | "rev": "3ba30b149f9eb2bbf42cf4758d2158ca8cceef73", | 1288 | "rev": "388d291e82ffbc73be18169d39470f340707edaa", |
1288 | "type": "github" | 1289 | "type": "github" |
1289 | }, | 1290 | }, |
1290 | "original": { | 1291 | "original": { |
1291 | "owner": "Supreeeme", | 1292 | "owner": "Supreeeme", |
1292 | "ref": "v0.6", | 1293 | "ref": "v0.7", |
1293 | "repo": "xwayland-satellite", | 1294 | "repo": "xwayland-satellite", |
1294 | "type": "github" | 1295 | "type": "github" |
1295 | } | 1296 | } |
@@ -1297,11 +1298,11 @@ | |||
1297 | "xwayland-satellite-unstable": { | 1298 | "xwayland-satellite-unstable": { |
1298 | "flake": false, | 1299 | "flake": false, |
1299 | "locked": { | 1300 | "locked": { |
1300 | "lastModified": 1755219541, | 1301 | "lastModified": 1757179758, |
1301 | "narHash": "sha256-yKV6xHaPbEbh5RPxAJnb9yTs1wypr7do86hFFGQm1w8=", | 1302 | "narHash": "sha256-TIvyWzRt1miQj6Cf5Wy8Qz43XIZX7c4vTVwRLAT5S4Y=", |
1302 | "owner": "Supreeeme", | 1303 | "owner": "Supreeeme", |
1303 | "repo": "xwayland-satellite", | 1304 | "repo": "xwayland-satellite", |
1304 | "rev": "5a184d435927c3423f0ad189ea2b490578450fb7", | 1305 | "rev": "970728d0d9d1eada342bb8860af214b601139e58", |
1305 | "type": "github" | 1306 | "type": "github" |
1306 | }, | 1307 | }, |
1307 | "original": { | 1308 | "original": { |
@@ -209,7 +209,12 @@ | |||
209 | ref = "main"; | 209 | ref = "main"; |
210 | inputs = { | 210 | inputs = { |
211 | nixpkgs.follows = "nixpkgs"; | 211 | nixpkgs.follows = "nixpkgs"; |
212 | # niri-unstable.url = "github:gkleen/niri"; | 212 | niri-unstable = { |
213 | type = "github"; | ||
214 | owner = "gkleen"; | ||
215 | repo = "niri"; | ||
216 | ref = "feat/unix-sockets"; | ||
217 | }; | ||
213 | }; | 218 | }; |
214 | }; | 219 | }; |
215 | nix-monitored = { | 220 | nix-monitored = { |
diff --git a/overlays/niri.nix b/overlays/niri.nix index 9188ed7d..95a918b0 100644 --- a/overlays/niri.nix +++ b/overlays/niri.nix | |||
@@ -3,6 +3,7 @@ | |||
3 | (final: prev: { | 3 | (final: prev: { |
4 | niri-unstable = prev.niri-unstable.overrideAttrs (oldAttrs: { | 4 | niri-unstable = prev.niri-unstable.overrideAttrs (oldAttrs: { |
5 | buildInputs = (oldAttrs.buildInputs or []) ++ [ final.libgbm ]; | 5 | buildInputs = (oldAttrs.buildInputs or []) ++ [ final.libgbm ]; |
6 | doCheck = false; | ||
6 | }); | 7 | }); |
7 | }) | 8 | }) |
8 | final prev | 9 | final prev |
diff --git a/overlays/quickshell/default.nix b/overlays/quickshell/default.nix index 622d69a3..d806753f 100644 --- a/overlays/quickshell/default.nix +++ b/overlays/quickshell/default.nix | |||
@@ -5,6 +5,7 @@ | |||
5 | ./greetd-response.patch | 5 | ./greetd-response.patch |
6 | ./lock-state-changed.patch | 6 | ./lock-state-changed.patch |
7 | ./pipewire.patch | 7 | ./pipewire.patch |
8 | ./io.patch | ||
8 | ]; | 9 | ]; |
9 | }); | 10 | }); |
10 | } | 11 | } |
diff --git a/overlays/quickshell/io.patch b/overlays/quickshell/io.patch new file mode 100644 index 00000000..961bdcaf --- /dev/null +++ b/overlays/quickshell/io.patch | |||
@@ -0,0 +1,13 @@ | |||
1 | diff --git i/src/io/socket.cpp w/src/io/socket.cpp | ||
2 | index 371f687..d12eaeb 100644 | ||
3 | --- i/src/io/socket.cpp | ||
4 | +++ w/src/io/socket.cpp | ||
5 | @@ -66,7 +66,7 @@ void Socket::onSocketDisconnected() { | ||
6 | } | ||
7 | |||
8 | void Socket::onSocketError(QLocalSocket::LocalSocketError error) { | ||
9 | - qCWarning(logSocket) << "Socket error for" << this << error; | ||
10 | + // qCWarning(logSocket) << "Socket error for" << this << error; | ||
11 | emit this->error(error); | ||
12 | } | ||
13 | |||