diff options
Diffstat (limited to 'accounts/gkleen@sif/niri/waybar.nix')
-rw-r--r-- | accounts/gkleen@sif/niri/waybar.nix | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/accounts/gkleen@sif/niri/waybar.nix b/accounts/gkleen@sif/niri/waybar.nix index 79c429f8..c02a9a76 100644 --- a/accounts/gkleen@sif/niri/waybar.nix +++ b/accounts/gkleen@sif/niri/waybar.nix | |||
@@ -1,5 +1,7 @@ | |||
1 | { lib, pkgs, ... }: | 1 | { lib, config, pkgs, ... }: |
2 | { | 2 | let |
3 | swayosd-client = lib.getExe' config.services.swayosd.package "swayosd-client"; | ||
4 | in { | ||
3 | config = { | 5 | config = { |
4 | programs.waybar = { | 6 | programs.waybar = { |
5 | enable = true; | 7 | enable = true; |
@@ -18,15 +20,21 @@ | |||
18 | { | 20 | { |
19 | layer = "top"; | 21 | layer = "top"; |
20 | position = "top"; | 22 | position = "top"; |
21 | height = 14; | 23 | height = 21; |
22 | output = [ "eDP-1" "DP-2" "DP-3" ]; | 24 | output = [ "eDP-1" "DP-2" "DP-3" ]; |
23 | modules-left = [ "niri/workspaces" ]; | 25 | modules-left = [ "niri/workspaces" ]; |
24 | modules-center = [ "niri/window" ]; | 26 | modules-center = [ "niri/window" ]; |
25 | modules-right = [ # "custom/worktime" "custom/worktime-today" | 27 | modules-right = [ "custom/worktime" "custom/worktime-today" |
26 | "custom/weather" | 28 | "custom/weather" |
27 | "custom/keymap" | 29 | "custom/keymap" |
28 | "privacy" "tray" "wireplumber" "backlight" "battery" "idle_inhibitor" "custom/mako" "clock" ]; | 30 | "privacy" "tray" "wireplumber" "backlight" "battery" "idle_inhibitor" "custom/mako" "custom/lid_inhibitor" "clock" ]; |
29 | 31 | ||
32 | "custom/lid_inhibitor" = { | ||
33 | format = "{}"; | ||
34 | return-type = "json"; | ||
35 | exec = lib.getExe pkgs.waybar-systemd-inhibit; | ||
36 | on-click = lib.getExe' pkgs.waybar-systemd-inhibit "waybar-systemd-inhibit-toggle"; | ||
37 | }; | ||
30 | "custom/mako" = { | 38 | "custom/mako" = { |
31 | format = "{}"; | 39 | format = "{}"; |
32 | return-type = "json"; | 40 | return-type = "json"; |
@@ -59,7 +67,7 @@ | |||
59 | text = f"<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>" # noqa: E501 | 67 | text = f"<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>" # noqa: E501 |
60 | if is_silent: | 68 | if is_silent: |
61 | text = f"<span color=\"#ffffff\">{text}</span>" | 69 | text = f"<span color=\"#ffffff\">{text}</span>" |
62 | print(json.dumps({'text': text}, separators=(',', ':')), flush=True) # noqa: E501 | 70 | print(json.dumps({'text': text, 'tooltip': ', '.join(modes)}, separators=(',', ':')), flush=True) # noqa: E501 |
63 | 71 | ||
64 | async def on_properties_changed(interface_name, changed_properties, invalidated_properties): # noqa: E501 | 72 | async def on_properties_changed(interface_name, changed_properties, invalidated_properties): # noqa: E501 |
65 | if "Modes" not in invalidated_properties: | 73 | if "Modes" not in invalidated_properties: |
@@ -120,16 +128,16 @@ | |||
120 | }; | 128 | }; |
121 | "custom/worktime" = { | 129 | "custom/worktime" = { |
122 | interval = 60; | 130 | interval = 60; |
123 | exec = lib.getExe pkgs.worktime; | 131 | exec = "${lib.getExe pkgs.worktime} time --waybar"; |
124 | tooltip = false; | 132 | return-type = "json"; |
125 | }; | 133 | }; |
126 | "custom/worktime-today" = { | 134 | "custom/worktime-today" = { |
127 | interval = 60; | 135 | interval = 60; |
128 | exec = "${lib.getExe pkgs.worktime} today"; | 136 | exec = "${lib.getExe pkgs.worktime} today --waybar"; |
129 | tooltip = false; | 137 | return-type = "json"; |
130 | }; | 138 | }; |
131 | "niri/workspaces" = { | 139 | "niri/workspaces" = { |
132 | ignore = ["pwctl" "kpxc" "bmgr" "edit" "term"]; | 140 | ignore = map ({ name, ... }: name) config.programs.niri.scratchspaces; |
133 | }; | 141 | }; |
134 | "niri/window" = { | 142 | "niri/window" = { |
135 | separate-outputs = true; | 143 | separate-outputs = true; |
@@ -190,8 +198,8 @@ | |||
190 | icon-size = iconSize; | 198 | icon-size = iconSize; |
191 | tooltip-format = "{percent}%"; | 199 | tooltip-format = "{percent}%"; |
192 | format-icons = ["󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠"]; | 200 | format-icons = ["󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠"]; |
193 | on-scroll-up = "lightctl -d -e4 -n1 up"; | 201 | on-scroll-up = "${swayosd-client} --brightness raise"; |
194 | on-scroll-down = "lightctl -d -e4 -n1 down"; | 202 | on-scroll-down = "${swayosd-client} --brightness lower"; |
195 | }; | 203 | }; |
196 | wireplumber = { | 204 | wireplumber = { |
197 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; | 205 | format = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>"; |
@@ -200,22 +208,22 @@ | |||
200 | format-icons = ["󰕿" "󰖀" "󰕾"]; | 208 | format-icons = ["󰕿" "󰖀" "󰕾"]; |
201 | format-muted = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">󰝟</span>"; | 209 | format-muted = "<span font=\"Symbols Nerd Font Mono\" size=\"90%\">󰝟</span>"; |
202 | # ignored-sinks = ["Easy Effects Sink"]; | 210 | # ignored-sinks = ["Easy Effects Sink"]; |
203 | on-scroll-up = "volumectl -d -u up"; | 211 | on-scroll-up = "${swayosd-client} --output-volume raise"; |
204 | on-scroll-down = "volumectl -d -u down"; | 212 | on-scroll-down = "${swayosd-client} --output-volume lower"; |
205 | on-click = "volumectl -d toggle-mute"; | 213 | on-click = "${swayosd-client} --output-volume mute-toggle"; |
206 | }; | 214 | }; |
207 | } | 215 | } |
208 | { | 216 | { |
209 | layer = "top"; | 217 | layer = "top"; |
210 | position = "top"; | 218 | position = "top"; |
211 | height = 14; | 219 | height = 14; |
212 | output = [ "!eDP-1" "!DP-2" "!DP-3" ]; | 220 | output = [ "!eDP-1" "!DP-2" "!DP-3" "*" ]; |
213 | modules-left = [ "niri/workspaces" ]; | 221 | modules-left = [ "niri/workspaces" ]; |
214 | modules-center = [ "niri/window" ]; | 222 | modules-center = [ "niri/window" ]; |
215 | modules-right = [ "clock" ]; | 223 | modules-right = [ "clock" ]; |
216 | 224 | ||
217 | "niri/workspaces" = { | 225 | "niri/workspaces" = { |
218 | ignore = ["pwctl" "kpxc" "bmgr" "edit" "term"]; | 226 | ignore = map ({ name, ... }: name) config.programs.niri.scratchspaces; |
219 | }; | 227 | }; |
220 | "niri/window" = { | 228 | "niri/window" = { |
221 | separate-outputs = true; | 229 | separate-outputs = true; |
@@ -241,7 +249,7 @@ | |||
241 | 249 | ||
242 | * { | 250 | * { |
243 | border: none; | 251 | border: none; |
244 | font-family: "Fira Sans Nerd Font"; | 252 | font-family: "Fira Sans"; |
245 | font-size: 10pt; | 253 | font-size: 10pt; |
246 | min-height: 0; | 254 | min-height: 0; |
247 | } | 255 | } |
@@ -252,10 +260,10 @@ | |||
252 | } | 260 | } |
253 | 261 | ||
254 | .modules-left { | 262 | .modules-left { |
255 | margin-left: 8px; | 263 | margin-left: 38px; |
256 | } | 264 | } |
257 | .modules-right { | 265 | .modules-right { |
258 | margin-right: 8px; | 266 | margin-right: 38px; |
259 | } | 267 | } |
260 | 268 | ||
261 | .module { | 269 | .module { |
@@ -280,17 +288,18 @@ | |||
280 | color: @grey; | 288 | color: @grey; |
281 | margin: 0 5px; | 289 | margin: 0 5px; |
282 | } | 290 | } |
283 | #custom-weather, #custom-worktime-today { | 291 | #custom-weather { |
284 | margin-right: 3px; | 292 | margin-right: 3px; |
285 | } | 293 | } |
286 | #custom-keymap, #custom-weather { | 294 | #custom-keymap { |
287 | margin-left: 3px; | 295 | margin-left: 3px; |
296 | margin-right: 3px; | ||
288 | } | 297 | } |
289 | 298 | ||
290 | #tray { | 299 | #tray { |
291 | margin: 0; | 300 | margin: 0; |
292 | } | 301 | } |
293 | #battery, #idle_inhibitor, #backlight, #wireplumber, #custom-mako { | 302 | #battery, #idle_inhibitor, #backlight, #wireplumber, #custom-mako, #custom-lid_inhibitor { |
294 | color: @grey; | 303 | color: @grey; |
295 | margin: 0 5px 0 2px; | 304 | margin: 0 5px 0 2px; |
296 | } | 305 | } |
@@ -299,7 +308,11 @@ | |||
299 | margin-left: 6px; | 308 | margin-left: 6px; |
300 | } | 309 | } |
301 | #custom-mako { | 310 | #custom-mako { |
302 | margin-right: 2px; | 311 | margin-right: 4px; |
312 | margin-left: 3px; | ||
313 | } | ||
314 | #custom-lid_inhibitor { | ||
315 | margin-right: 3px; | ||
303 | margin-left: 3px; | 316 | margin-left: 3px; |
304 | } | 317 | } |
305 | #battery { | 318 | #battery { |
@@ -320,17 +333,24 @@ | |||
320 | #idle_inhibitor.activated { | 333 | #idle_inhibitor.activated { |
321 | color: @white; | 334 | color: @white; |
322 | } | 335 | } |
336 | #custom-worktime.running, #custom-worktime-today.running { | ||
337 | color: @white; | ||
338 | } | ||
339 | #custom-worktime.over, #custom-worktime-today.over { | ||
340 | color: @orange; | ||
341 | } | ||
323 | 342 | ||
324 | #idle_inhibitor { | 343 | #idle_inhibitor, #custom-lid_inhibitor { |
325 | padding-top: 1px; | 344 | padding-top: 1px; |
326 | } | 345 | } |
327 | 346 | ||
328 | #privacy { | 347 | #privacy { |
329 | color: @red; | 348 | color: @red; |
330 | margin: -1px 2px 0px 5px; | 349 | margin: -1px 4px 0px 3px; |
331 | } | 350 | } |
332 | #clock { | 351 | #clock { |
333 | /* margin-right: 5px; */ | 352 | /* margin-right: 5px; */ |
353 | font-feature-settings: "tnum"; | ||
334 | } | 354 | } |
335 | ''; | 355 | ''; |
336 | }; | 356 | }; |