summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/niri/default.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-01-14 17:11:24 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2025-01-14 17:11:24 +0100
commit8c96c502e16471b564a727c0ebb3b21c92e844ad (patch)
tree83604d4abe31c055440b1761a35144294239a293 /accounts/gkleen@sif/niri/default.nix
parentc744867b5adc417748f6ed6fdb17cb6e4c6fc46b (diff)
downloadnixos-8c96c502e16471b564a727c0ebb3b21c92e844ad.tar
nixos-8c96c502e16471b564a727c0ebb3b21c92e844ad.tar.gz
nixos-8c96c502e16471b564a727c0ebb3b21c92e844ad.tar.bz2
nixos-8c96c502e16471b564a727c0ebb3b21c92e844ad.tar.xz
nixos-8c96c502e16471b564a727c0ebb3b21c92e844ad.zip
...
Diffstat (limited to 'accounts/gkleen@sif/niri/default.nix')
-rw-r--r--accounts/gkleen@sif/niri/default.nix71
1 files changed, 63 insertions, 8 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix
index b6165487..6aa4391c 100644
--- a/accounts/gkleen@sif/niri/default.nix
+++ b/accounts/gkleen@sif/niri/default.nix
@@ -10,14 +10,19 @@ let
10 10
11 focus-or-spawn = pkgs.writeShellApplication { 11 focus-or-spawn = pkgs.writeShellApplication {
12 name = "focus-or-spawn"; 12 name = "focus-or-spawn";
13 runtimeInputs = [ niri pkgs.gojq pkgs.gnugrep ]; 13 runtimeInputs = [ niri pkgs.gojq pkgs.gnugrep pkgs.socat ];
14 text = '' 14 text = ''
15 app_id="$1" 15 app_id="$1"
16 shift 16 shift
17 workspace_name="$1" 17 workspace_name="$1"
18 shift 18 shift
19 19
20 niri msg action move-workspace-to-monitor --output "$(niri msg -j workspaces | jq -r '.[] | select(.is_focused) | .output')" "$workspace_name" 20 workspaces_json="$(niri msg -j workspaces)"
21 workspace_output="$(jq -r --arg workspace_name "$workspace_name" '.[] | select(.name == $workspace_name) | .output' <<<"$workspaces_json")"
22 active_workspace="$(jq -r --arg workspace_output "$workspace_output" '.[] | select(.output == $workspace_output and .is_active) | .id' <<<"$workspaces_json")"
23 niri msg action move-workspace-to-monitor --output "$(jq -r '.[] | select(.is_focused) | .output' <<<"$workspaces_json")" "$workspace_name"
24 socat STDIO "$NIRI_SOCKET" <<<'{"Action":{"FocusWorkspace":{"reference":{"Id":'"''${active_workspace}"'}}}}'
25 niri msg action move-workspace-to-index --index 1 "$workspace_name"
21 26
22 while IFS=$'\n' read -r window_json; do 27 while IFS=$'\n' read -r window_json; do
23 if jq -r '.app_id' <<<"$window_json" | grep -q "$app_id"; then 28 if jq -r '.app_id' <<<"$window_json" | grep -q "$app_id"; then
@@ -109,13 +114,19 @@ in {
109 focus-ring = { 114 focus-ring = {
110 width = 2; 115 width = 2;
111 }; 116 };
112 empty-workspace-above-first = true;
113 }; 117 };
114 118
115 cursor.hide-when-typing = true; 119 cursor.hide-when-typing = true;
116 120
117 workspaces = { 121 workspaces = {
118 "01".name = "pwctl"; 122 "001".name = "pwctl";
123 "002".name = "kpxc";
124 "003".name = "bmgr";
125 "101".name = "comm";
126 "102".name = "web";
127 "104".name = "read";
128 "105".name = "mon";
129 "110".name = "vid";
119 }; 130 };
120 131
121 window-rules = [ 132 window-rules = [
@@ -125,12 +136,54 @@ in {
125 allCorners = r: { bottom-left = r; bottom-right = r; top-left = r; top-right = r; }; 136 allCorners = r: { bottom-left = r; bottom-right = r; top-left = r; top-right = r; };
126 in allCorners 8.; 137 in allCorners 8.;
127 clip-to-geometry = true; 138 clip-to-geometry = true;
128 open-focused = false;
129 } 139 }
130 { 140 {
131 matches = [ { app-id = "^com\.saivert\.pwvucontrol$"; } ]; 141 matches = [ { app-id = "^com\.saivert\.pwvucontrol$"; } ];
132 open-on-workspace = "pwctl"; 142 open-on-workspace = "pwctl";
133 open-focused = true; 143 }
144 {
145 matches = [ { app-id = "^\.blueman-manager-wrapped$"; } ];
146 open-on-workspace = "bmgr";
147 }
148 {
149 matches = [ { app-id = "^org\.keepassxc\.KeePassXC$"; } ];
150 excludes = [
151 { title = "^Unlock Database"; }
152 { title = "^Access Request"; }
153 { title = "^Passkey credentials"; }
154 ];
155 open-on-workspace = "kpxc";
156 open-focused = false;
157 }
158 {
159 matches = [
160 { app-id = "^thunderbird$"; }
161 { app-id = "^Element$"; }
162 ];
163 open-on-workspace = "comm";
164 }
165 {
166 matches = [ { app-id = "^firefox$"; } ];
167 open-on-workspace = "web";
168 }
169 {
170 matches = [
171 { app-id = "^evince$"; }
172 { app-id = "^imv$"; }
173 { app-id = "^org\.pwmt\.zathura$"; }
174 ];
175 open-on-workspace = "read";
176 }
177 {
178 matches = [ { app-id = "^mpv$"; } ];
179 open-on-workspace = "vid";
180 }
181 {
182 matches = [
183 { app-id = "^qemu$"; }
184 { app-id = "^virt-manager$"; }
185 ];
186 open-on-workspace = "mon";
134 } 187 }
135 ]; 188 ];
136 189
@@ -180,8 +233,8 @@ in {
180 "Mod+Shift+F".action = maximize-column; 233 "Mod+Shift+F".action = maximize-column;
181 "Mod+Shift+Ctrl+F".action = fullscreen-window; 234 "Mod+Shift+Ctrl+F".action = fullscreen-window;
182 235
183 "Mod+Space".action = switch-focus-between-floating-and-tiling; 236 "Mod+B".action = switch-focus-between-floating-and-tiling;
184 "Mod+Shift+Space".action = toggle-window-floating; 237 "Mod+Shift+B".action = toggle-window-floating;
185 238
186 "Mod+Left".action = set-column-width "-10%"; 239 "Mod+Left".action = set-column-width "-10%";
187 "Mod+Down".action = set-window-height "-10%"; 240 "Mod+Down".action = set-window-height "-10%";
@@ -228,6 +281,8 @@ in {
228 "Mod+Comma".action = spawn dunstctl "history-pop"; 281 "Mod+Comma".action = spawn dunstctl "history-pop";
229 282
230 "Mod+Alt+A".action = focus-or-spawn-action "^com\.saivert\.pwvucontrol$" "pwctl" "pwvucontrol"; 283 "Mod+Alt+A".action = focus-or-spawn-action "^com\.saivert\.pwvucontrol$" "pwctl" "pwvucontrol";
284 "Mod+Alt+P".action = focus-or-spawn-action "^org\.keepassxc\.KeePassXC$" "kpxc" "keepassxc";
285 "Mod+Alt+B".action = focus-or-spawn-action "^\.blueman-manager-wrapped$" "bmgr" "blueman-manager";
231 }; 286 };
232 }; 287 };
233 }; 288 };