summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/niri
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/niri')
-rw-r--r--accounts/gkleen@sif/niri/default.nix29
-rw-r--r--accounts/gkleen@sif/niri/mako.nix28
-rw-r--r--accounts/gkleen@sif/niri/waybar.nix58
3 files changed, 99 insertions, 16 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix
index 841c972a..cc6c85c3 100644
--- a/accounts/gkleen@sif/niri/default.nix
+++ b/accounts/gkleen@sif/niri/default.nix
@@ -4,7 +4,7 @@ let
4 terminal = lib.getExe config.programs.kitty.package; 4 terminal = lib.getExe config.programs.kitty.package;
5 lightctl = lib.getExe' config.services.avizo.package "lightctl"; 5 lightctl = lib.getExe' config.services.avizo.package "lightctl";
6 volumectl = lib.getExe' config.services.avizo.package "volumectl"; 6 volumectl = lib.getExe' config.services.avizo.package "volumectl";
7 dunstctl = lib.getExe' config.services.dunst.package "dunstctl"; 7 makoctl = lib.getExe' config.services.mako.package "makoctl";
8 loginctl = lib.getExe' hostConfig.systemd.package "loginctl"; 8 loginctl = lib.getExe' hostConfig.systemd.package "loginctl";
9 systemctl = lib.getExe' hostConfig.systemd.package "systemctl"; 9 systemctl = lib.getExe' hostConfig.systemd.package "systemctl";
10 10
@@ -121,6 +121,7 @@ let
121in { 121in {
122 imports = [ 122 imports = [
123 ./waybar.nix 123 ./waybar.nix
124 ./mako.nix
124 ]; 125 ];
125 126
126 config = { 127 config = {
@@ -244,13 +245,13 @@ in {
244 }; 245 };
245 246
246 window-rules = [ 247 window-rules = [
247 { 248 # {
248 geometry-corner-radius = 249 # geometry-corner-radius =
249 let 250 # let
250 allCorners = r: { bottom-left = r; bottom-right = r; top-left = r; top-right = r; }; 251 # allCorners = r: { bottom-left = r; bottom-right = r; top-left = r; top-right = r; };
251 in allCorners 4.; 252 # in allCorners 4.;
252 clip-to-geometry = true; 253 # clip-to-geometry = true;
253 } 254 # }
254 { 255 {
255 matches = [ { app-id = "^com\.saivert\.pwvucontrol$"; } ]; 256 matches = [ { app-id = "^com\.saivert\.pwvucontrol$"; } ];
256 open-on-workspace = "pwctl"; 257 open-on-workspace = "pwctl";
@@ -264,7 +265,7 @@ in {
264 excludes = [ 265 excludes = [
265 { title = "^Unlock Database.*"; } 266 { title = "^Unlock Database.*"; }
266 { title = "^Access Request.*"; } 267 { title = "^Access Request.*"; }
267 { title = "^Passkey credentials.*"; } 268 { title = ".*Passkey credentials$"; }
268 ]; 269 ];
269 open-on-workspace = "kpxc"; 270 open-on-workspace = "kpxc";
270 open-focused = false; 271 open-focused = false;
@@ -273,7 +274,7 @@ in {
273 matches = [ 274 matches = [
274 { app-id = "^org\.keepassxc\.KeePassXC$"; title = "^Unlock Database.*"; } 275 { app-id = "^org\.keepassxc\.KeePassXC$"; title = "^Unlock Database.*"; }
275 { app-id = "^org\.keepassxc\.KeePassXC$"; title = "^Access Request.*"; } 276 { app-id = "^org\.keepassxc\.KeePassXC$"; title = "^Access Request.*"; }
276 { app-id = "^org\.keepassxc\.KeePassXC$"; title = "^Passkey credentials.*"; } 277 { app-id = "^org\.keepassxc\.KeePassXC$"; title = ".*Passkey credentials$"; }
277 ]; 278 ];
278 open-focused = true; 279 open-focused = true;
279 } 280 }
@@ -519,10 +520,10 @@ in {
519 allow-when-locked = true; 520 allow-when-locked = true;
520 }; 521 };
521 522
522 "Mod+Semicolon".action = spawn dunstctl "close"; 523 "Mod+Semicolon".action = spawn makoctl "dismiss";
523 "Mod+Shift+Semicolon".action = spawn dunstctl "close-all"; 524 "Mod+Shift+Semicolon".action = spawn makoctl "dismiss" "--all";
524 "Mod+Period".action = spawn dunstctl "context"; 525 "Mod+Period".action = spawn makoctl (lib.getExe config.programs.fuzzel.package) "--dmenu";
525 "Mod+Comma".action = spawn dunstctl "history-pop"; 526 "Mod+Comma".action = spawn makoctl "restore";
526 527
527 "Mod+Control+A".action = focus-or-spawn-action-app_id "com.saivert.pwvucontrol" "pwctl" "pwvucontrol"; 528 "Mod+Control+A".action = focus-or-spawn-action-app_id "com.saivert.pwvucontrol" "pwctl" "pwvucontrol";
528 "Mod+Control+P".action = focus-or-spawn-action-app_id "org.keepassxc.KeePassXC" "kpxc" "keepassxc"; 529 "Mod+Control+P".action = focus-or-spawn-action-app_id "org.keepassxc.KeePassXC" "kpxc" "keepassxc";
diff --git a/accounts/gkleen@sif/niri/mako.nix b/accounts/gkleen@sif/niri/mako.nix
new file mode 100644
index 00000000..7e31f7e1
--- /dev/null
+++ b/accounts/gkleen@sif/niri/mako.nix
@@ -0,0 +1,28 @@
1{ config, lib, ... }:
2{
3 config = {
4 services.mako = {
5 enable = true;
6 font = "Fira Sans 10";
7 format = "<i>%s</i>\\n%b";
8 margin = "2";
9 maxVisible = -1;
10 backgroundColor = "#000000dd";
11 progressColor = "source #223544ff";
12 width = 384;
13 extraConfig = ''
14 outer-margin=1
15 max-history=100
16
17 [urgency=low]
18 text-color=#999999ff
19
20 [urgency=critical]
21 background-color=#900000dd
22
23 [mode=silent]
24 invisible=1
25 '';
26 };
27 };
28}
diff --git a/accounts/gkleen@sif/niri/waybar.nix b/accounts/gkleen@sif/niri/waybar.nix
index ff48ba83..26e76a1d 100644
--- a/accounts/gkleen@sif/niri/waybar.nix
+++ b/accounts/gkleen@sif/niri/waybar.nix
@@ -25,8 +25,58 @@
25 modules-right = [ # "custom/worktime" "custom/worktime-today" 25 modules-right = [ # "custom/worktime" "custom/worktime-today"
26 "custom/weather" 26 "custom/weather"
27 "custom/keymap" 27 "custom/keymap"
28 "privacy" "tray" "wireplumber" "backlight" "battery" "idle_inhibitor" "clock" ]; 28 "privacy" "tray" "wireplumber" "backlight" "battery" "idle_inhibitor" "custom/mako" "clock" ];
29 29
30 "custom/mako" = {
31 format = "{}";
32 return-type = "json";
33 exec = pkgs.writers.writePython3 "mako-silent" { libraries = [ pkgs.python3Packages.dbus-next ]; } ''
34 from dbus_next.aio import MessageBus
35
36 import asyncio
37
38 import json
39
40
41 loop = asyncio.new_event_loop()
42 asyncio.set_event_loop(loop)
43
44
45 async def main():
46 bus = await MessageBus().connect()
47 # the introspection xml would normally be included in your project, but
48 # this is convenient for development
49 introspection = await bus.introspect('org.freedesktop.Notifications', '/fr/emersion/Mako') # noqa: E501
50
51 obj = bus.get_proxy_object('org.freedesktop.Notifications', '/fr/emersion/Mako', introspection) # noqa: E501
52 mako = obj.get_interface('fr.emersion.Mako')
53 properties = obj.get_interface('org.freedesktop.DBus.Properties')
54
55 async def print_mode():
56 modes = await mako.get_modes()
57 is_silent = "silent" in modes
58 icon = "&#xf009b;" if is_silent else "&#xf009a;"
59 text = f"<span font=\"Symbols Nerd Font Mono\" size=\"90%\">{icon}</span>" # noqa: E501
60 if is_silent:
61 text = f"<span color=\"#ffffff\">{text}</span>"
62 print(json.dumps({'text': text}, separators=(',', ':')), flush=True) # noqa: E501
63
64 async def on_properties_changed(interface_name, changed_properties, invalidated_properties): # noqa: E501
65 if "Modes" not in invalidated_properties:
66 return
67
68 await print_mode()
69
70 properties.on_properties_changed(on_properties_changed)
71 await print_mode()
72
73 await loop.create_future()
74
75
76 loop.run_until_complete(main())
77 '';
78 on-click = "makoctl mode -t silent";
79 };
30 "custom/weather" = { 80 "custom/weather" = {
31 format = "{}"; 81 format = "{}";
32 tooltip = true; 82 tooltip = true;
@@ -240,11 +290,15 @@
240 #tray { 290 #tray {
241 margin: 0; 291 margin: 0;
242 } 292 }
243 #battery, #idle_inhibitor, #backlight, #wireplumber { 293 #battery, #idle_inhibitor, #backlight, #wireplumber, #custom-mako {
244 color: @grey; 294 color: @grey;
245 margin: 0 5px 0 2px; 295 margin: 0 5px 0 2px;
246 } 296 }
247 #idle_inhibitor { 297 #idle_inhibitor {
298 margin-right: 4px;
299 margin-left: 6px;
300 }
301 #custom-mako {
248 margin-right: 2px; 302 margin-right: 2px;
249 margin-left: 3px; 303 margin-left: 3px;
250 } 304 }