diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-01-14 15:05:32 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-01-14 15:05:40 +0100 |
commit | c744867b5adc417748f6ed6fdb17cb6e4c6fc46b (patch) | |
tree | cc970543a9e601244f5fab956f52e999b686f4a1 /accounts/gkleen@sif | |
parent | 21b52a31e1eff5c8142f26e091fde083c21db55f (diff) | |
download | nixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.tar nixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.tar.gz nixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.tar.bz2 nixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.tar.xz nixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.zip |
...
Diffstat (limited to 'accounts/gkleen@sif')
-rw-r--r-- | accounts/gkleen@sif/niri/default.nix | 117 | ||||
-rw-r--r-- | accounts/gkleen@sif/niri/waybar.nix | 16 | ||||
-rw-r--r-- | accounts/gkleen@sif/systemd.nix | 14 |
3 files changed, 111 insertions, 36 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix index 6a8d10a0..b6165487 100644 --- a/accounts/gkleen@sif/niri/default.nix +++ b/accounts/gkleen@sif/niri/default.nix | |||
@@ -1,10 +1,35 @@ | |||
1 | { config, pkgs, lib, ... }: | 1 | { config, hostConfig, pkgs, lib, ... }: |
2 | let | 2 | let |
3 | niri = config.programs.niri.package; | 3 | niri = config.programs.niri.package; |
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 | dunstctl = lib.getExe' config.services.dunst.package "dunstctl"; |
8 | loginctl = lib.getExe' hostConfig.systemd.package "loginctl"; | ||
9 | systemctl = lib.getExe' hostConfig.systemd.package "systemctl"; | ||
10 | |||
11 | focus-or-spawn = pkgs.writeShellApplication { | ||
12 | name = "focus-or-spawn"; | ||
13 | runtimeInputs = [ niri pkgs.gojq pkgs.gnugrep ]; | ||
14 | text = '' | ||
15 | app_id="$1" | ||
16 | shift | ||
17 | workspace_name="$1" | ||
18 | shift | ||
19 | |||
20 | niri msg action move-workspace-to-monitor --output "$(niri msg -j workspaces | jq -r '.[] | select(.is_focused) | .output')" "$workspace_name" | ||
21 | |||
22 | while IFS=$'\n' read -r window_json; do | ||
23 | if jq -r '.app_id' <<<"$window_json" | grep -q "$app_id"; then | ||
24 | niri msg action focus-window --id "$(jq -r '.id' <<<"$window_json")" | ||
25 | exit 0 | ||
26 | fi | ||
27 | done < <(niri msg -j windows | jq -c '.[]') | ||
28 | |||
29 | exec "$@" | ||
30 | ''; | ||
31 | }; | ||
32 | focus-or-spawn-action = app_id: workspace_name: config.lib.niri.actions.spawn (lib.getExe focus-or-spawn) (lib.escapeShellArg app_id) (lib.escapeShellArg workspace_name); | ||
8 | in { | 33 | in { |
9 | imports = [ | 34 | imports = [ |
10 | ./waybar.nix | 35 | ./waybar.nix |
@@ -21,7 +46,9 @@ in { | |||
21 | Service = { | 46 | Service = { |
22 | Type = "notify"; | 47 | Type = "notify"; |
23 | NotifyAccess = "all"; | 48 | NotifyAccess = "all"; |
24 | ExecStart = lib.getExe pkgs.xwayland-satellite-unstable; | 49 | Environment = [ "DISPLAY=:0" ]; |
50 | ExecStart = ''${lib.getExe pkgs.xwayland-satellite-unstable} ''${DISPLAY}''; | ||
51 | ExecStartPre = "${systemctl} --user import-environment DISPLAY"; | ||
25 | StandardOutput = "journal"; | 52 | StandardOutput = "journal"; |
26 | }; | 53 | }; |
27 | Install = { | 54 | Install = { |
@@ -29,16 +56,44 @@ in { | |||
29 | }; | 56 | }; |
30 | }; | 57 | }; |
31 | 58 | ||
59 | services.swayidle = { | ||
60 | events = [ | ||
61 | { event = "after-resume"; command = "${lib.getExe niri} msg action power-on-monitors"; } | ||
62 | ]; | ||
63 | timeouts = [ | ||
64 | { timeout = 300; | ||
65 | command = "${lib.getExe niri} msg action power-off-monitors"; | ||
66 | } | ||
67 | ]; | ||
68 | }; | ||
69 | |||
32 | programs.niri.settings = { | 70 | programs.niri.settings = { |
33 | prefer-no-csd = true; | 71 | prefer-no-csd = true; |
34 | screenshot-path = "${config.home.homeDirectory}/screenshots"; | 72 | screenshot-path = "${config.home.homeDirectory}/screenshots"; |
35 | 73 | ||
74 | hotkey-overlay.skip-at-startup = true; | ||
75 | |||
36 | input = { | 76 | input = { |
37 | keyboard.xkb = { | 77 | keyboard.xkb = { |
38 | layout = "us,"; | 78 | layout = "us,us"; |
39 | variant = "dvp,"; | 79 | variant = "dvp,"; |
40 | options = "compose:caps,grp:win_space_toggle"; | 80 | options = "compose:caps,grp:win_space_toggle"; |
41 | }; | 81 | }; |
82 | |||
83 | workspace-auto-back-and-forth = true; | ||
84 | # focus-follows-mouse.enable = true; | ||
85 | warp-mouse-to-focus = true; | ||
86 | }; | ||
87 | |||
88 | outputs = { | ||
89 | "Samsung Display Corp. 0x4141 Unknown" = { | ||
90 | scale = 1.5; | ||
91 | position = { x = 0; y = 0; }; | ||
92 | }; | ||
93 | "Ancor Communications Inc ASUS PB287Q 0x0000DD9B" = { | ||
94 | scale = 1.5; | ||
95 | position = { x = 2560; y = 0; }; | ||
96 | }; | ||
42 | }; | 97 | }; |
43 | 98 | ||
44 | environment = { | 99 | environment = { |
@@ -48,9 +103,40 @@ in { | |||
48 | SDL_VIDEODRIVER = "wayland"; | 103 | SDL_VIDEODRIVER = "wayland"; |
49 | }; | 104 | }; |
50 | 105 | ||
106 | layout = { | ||
107 | gaps = 8; | ||
108 | struts = { left = 8; right = 8; top = 0; bottom = 0; }; | ||
109 | focus-ring = { | ||
110 | width = 2; | ||
111 | }; | ||
112 | empty-workspace-above-first = true; | ||
113 | }; | ||
114 | |||
51 | cursor.hide-when-typing = true; | 115 | cursor.hide-when-typing = true; |
52 | 116 | ||
117 | workspaces = { | ||
118 | "01".name = "pwctl"; | ||
119 | }; | ||
120 | |||
121 | window-rules = [ | ||
122 | { | ||
123 | geometry-corner-radius = | ||
124 | let | ||
125 | allCorners = r: { bottom-left = r; bottom-right = r; top-left = r; top-right = r; }; | ||
126 | in allCorners 8.; | ||
127 | clip-to-geometry = true; | ||
128 | open-focused = false; | ||
129 | } | ||
130 | { | ||
131 | matches = [ { app-id = "^com\.saivert\.pwvucontrol$"; } ]; | ||
132 | open-on-workspace = "pwctl"; | ||
133 | open-focused = true; | ||
134 | } | ||
135 | ]; | ||
136 | |||
53 | binds = with config.lib.niri.actions; { | 137 | binds = with config.lib.niri.actions; { |
138 | "Mod+Slash".action = show-hotkey-overlay; | ||
139 | |||
54 | "Mod+Return".action = spawn terminal; | 140 | "Mod+Return".action = spawn terminal; |
55 | "Mod+Q".action = close-window; | 141 | "Mod+Q".action = close-window; |
56 | "Mod+D".action = spawn (lib.getExe config.programs.fuzzel.package); | 142 | "Mod+D".action = spawn (lib.getExe config.programs.fuzzel.package); |
@@ -79,17 +165,20 @@ in { | |||
79 | "Mod+G".action = focus-workspace-down; | 165 | "Mod+G".action = focus-workspace-down; |
80 | "Mod+C".action = focus-workspace-up; | 166 | "Mod+C".action = focus-workspace-up; |
81 | 167 | ||
82 | "Mod+Control+G".action = move-column-to-workspace-down; | 168 | "Mod+Shift+G".action = move-column-to-workspace-down; |
83 | "Mod+Control+C".action = move-column-to-workspace-up; | 169 | "Mod+Shift+C".action = move-column-to-workspace-up; |
84 | 170 | ||
85 | "Mod+Shift+G".action = move-workspace-down; | 171 | "Mod+Shift+Control+G".action = move-workspace-down; |
86 | "Mod+Shift+C".action = move-workspace-up; | 172 | "Mod+Shift+Control+C".action = move-workspace-up; |
87 | 173 | ||
88 | "Mod+M".action = consume-window-into-column; | 174 | "Mod+M".action = consume-or-expel-window-left; |
89 | "Mod+W".action = expel-window-from-column; | 175 | "Mod+W".action = consume-or-expel-window-right; |
90 | 176 | ||
91 | "Mod+F".action = maximize-column; | 177 | "Mod+R".action = switch-preset-column-width; |
92 | "Mod+Shift+F".action = fullscreen-window; | 178 | "Mod+Shift+R".action = switch-preset-window-height; |
179 | "Mod+F".action = center-column; | ||
180 | "Mod+Shift+F".action = maximize-column; | ||
181 | "Mod+Shift+Ctrl+F".action = fullscreen-window; | ||
93 | 182 | ||
94 | "Mod+Space".action = switch-focus-between-floating-and-tiling; | 183 | "Mod+Space".action = switch-focus-between-floating-and-tiling; |
95 | "Mod+Shift+Space".action = toggle-window-floating; | 184 | "Mod+Shift+Space".action = toggle-window-floating; |
@@ -103,6 +192,10 @@ in { | |||
103 | action = spawn (lib.getExe niri) "msg" "action" "power-off-monitors"; | 192 | action = spawn (lib.getExe niri) "msg" "action" "power-off-monitors"; |
104 | allow-when-locked = true; | 193 | allow-when-locked = true; |
105 | }; | 194 | }; |
195 | "Mod+Shift+L" = { | ||
196 | action = spawn loginctl "lock-session"; | ||
197 | }; | ||
198 | "Mod+Shift+E".action = quit; | ||
106 | 199 | ||
107 | "XF86MonBrightnessUp" = { | 200 | "XF86MonBrightnessUp" = { |
108 | action = spawn lightctl "-d" "-e4" "-n1" "up"; | 201 | action = spawn lightctl "-d" "-e4" "-n1" "up"; |
@@ -133,6 +226,8 @@ in { | |||
133 | "Mod+Shift+Semicolon".action = spawn dunstctl "close-all"; | 226 | "Mod+Shift+Semicolon".action = spawn dunstctl "close-all"; |
134 | "Mod+Period".action = spawn dunstctl "context"; | 227 | "Mod+Period".action = spawn dunstctl "context"; |
135 | "Mod+Comma".action = spawn dunstctl "history-pop"; | 228 | "Mod+Comma".action = spawn dunstctl "history-pop"; |
229 | |||
230 | "Mod+Alt+A".action = focus-or-spawn-action "^com\.saivert\.pwvucontrol$" "pwctl" "pwvucontrol"; | ||
136 | }; | 231 | }; |
137 | }; | 232 | }; |
138 | }; | 233 | }; |
diff --git a/accounts/gkleen@sif/niri/waybar.nix b/accounts/gkleen@sif/niri/waybar.nix index 1a25b581..2d00c6d8 100644 --- a/accounts/gkleen@sif/niri/waybar.nix +++ b/accounts/gkleen@sif/niri/waybar.nix | |||
@@ -80,9 +80,7 @@ | |||
80 | exec = "${lib.getExe pkgs.worktime} today"; | 80 | exec = "${lib.getExe pkgs.worktime} today"; |
81 | tooltip = false; | 81 | tooltip = false; |
82 | }; | 82 | }; |
83 | "niri/workspaces" = { | 83 | "niri/workspaces" = {}; |
84 | all-outputs = true; | ||
85 | }; | ||
86 | "niri/window" = { | 84 | "niri/window" = { |
87 | separate-outputs = true; | 85 | separate-outputs = true; |
88 | icon = true; | 86 | icon = true; |
@@ -166,9 +164,7 @@ | |||
166 | modules-center = [ "niri/window" ]; | 164 | modules-center = [ "niri/window" ]; |
167 | modules-right = [ "clock" ]; | 165 | modules-right = [ "clock" ]; |
168 | 166 | ||
169 | "niri/workspaces" = { | 167 | "niri/workspaces" = {}; |
170 | all-outputs = false; | ||
171 | }; | ||
172 | "niri/window" = { | 168 | "niri/window" = { |
173 | separate-outputs = true; | 169 | separate-outputs = true; |
174 | icon = true; | 170 | icon = true; |
@@ -215,13 +211,11 @@ | |||
215 | } | 211 | } |
216 | 212 | ||
217 | #workspaces button { | 213 | #workspaces button { |
218 | color: @grey; | ||
219 | } | ||
220 | #workspaces button.hosting-monitor { | ||
221 | color: @white; | 214 | color: @white; |
215 | padding: 2px 5px; | ||
222 | } | 216 | } |
223 | #workspaces button.visible { | 217 | #workspaces button.empty { |
224 | color: @blue; | 218 | color: @grey; |
225 | } | 219 | } |
226 | #workspaces button.active { | 220 | #workspaces button.active { |
227 | color: @green; | 221 | color: @green; |
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index c8400c28..119d8cc3 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
@@ -204,20 +204,6 @@ in { | |||
204 | WatchdogSec = "2s"; | 204 | WatchdogSec = "2s"; |
205 | }; | 205 | }; |
206 | }; | 206 | }; |
207 | polkit-gnome-authentication-agent-1 = { | ||
208 | Install = { | ||
209 | WantedBy = ["graphical-session.target"]; | ||
210 | }; | ||
211 | Unit = { | ||
212 | PartOf = ["graphical-session.target"]; | ||
213 | Requires = ["graphical-session-pre.target"]; | ||
214 | After = ["graphical-session-pre.target"]; | ||
215 | }; | ||
216 | Service = { | ||
217 | ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; | ||
218 | Restart = "on-failure"; | ||
219 | }; | ||
220 | }; | ||
221 | gtklock = { | 207 | gtklock = { |
222 | Unit = { | 208 | Unit = { |
223 | Requisite = ["graphical-session.target"]; | 209 | Requisite = ["graphical-session.target"]; |