From 41f0ee88ffdf2299390eca0fad2a55cb2d6abd0b Mon Sep 17 00:00:00 2001 From: funman300 Date: Thu, 16 Jul 2026 10:03:12 -0700 Subject: [PATCH] niri: working minimize via declared stash workspace Mod+M referenced an undeclared 'minimized' workspace, so it silently did nothing. Declare it, add focus=false so focus does not follow the window into the stash, and point Mod+Shift+M at the restore picker. niri pins declared named workspaces to index 1 and will not move them, so Mod+1..9 are offset by one. --- install.sh | 1 + niri/config.kdl | 51 ++++++++++++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/install.sh b/install.sh index 1cc8b1f..48d5615 100755 --- a/install.sh +++ b/install.sh @@ -55,6 +55,7 @@ ln -sf "$(pwd)/scripts/screenshot.sh" ~/.local/bin/screenshot ln -sf "$(pwd)/scripts/volume.sh" ~/.local/bin/volume ln -sf "$(pwd)/scripts/gamemode-session.sh" ~/.local/bin/gamemode-session ln -sf "$(pwd)/scripts/gamemode-watch.py" ~/.local/bin/gamemode-watch +ln -sf "$(pwd)/scripts/window-restore.py" ~/.local/bin/window-restore echo "==> Enabling systemd user services" mkdir -p ~/.config/systemd/user diff --git a/niri/config.kdl b/niri/config.kdl index b65db03..c157971 100644 --- a/niri/config.kdl +++ b/niri/config.kdl @@ -47,6 +47,13 @@ spawn-at-startup "wlsunset" "-l" "49.2" "-L" "-123.1" spawn-at-startup "xwayland-satellite" spawn-at-startup "gamemode-watch" +// Stash for minimized windows (Mod+M). niri pins declared named workspaces to +// index 1 and refuses to move them, so real workspaces start at index 2 — hence +// the +1 offset on the Mod+1..9 binds below. Do not remove this declaration: +// without it the "minimized" binds silently do nothing (niri validate still +// passes, because the name is just a string to the parser). +workspace "minimized" + binds { Mod+Q repeat=false { close-window; } Mod+F { fullscreen-window; } @@ -79,30 +86,34 @@ binds { Mod+Shift+Down { move-window-down; } Mod+Shift+Up { move-window-up; } - Mod+1 { focus-workspace 1; } - Mod+2 { focus-workspace 2; } - Mod+3 { focus-workspace 3; } - Mod+4 { focus-workspace 4; } - Mod+5 { focus-workspace 5; } - Mod+6 { focus-workspace 6; } - Mod+7 { focus-workspace 7; } - Mod+8 { focus-workspace 8; } - Mod+9 { focus-workspace 9; } + // +1 offset: the "minimized" workspace is always index 1 (see the + // declaration above), so the first real workspace is index 2. + Mod+1 { focus-workspace 2; } + Mod+2 { focus-workspace 3; } + Mod+3 { focus-workspace 4; } + Mod+4 { focus-workspace 5; } + Mod+5 { focus-workspace 6; } + Mod+6 { focus-workspace 7; } + Mod+7 { focus-workspace 8; } + Mod+8 { focus-workspace 9; } + Mod+9 { focus-workspace 10; } - Mod+Shift+1 { move-window-to-workspace 1; } - Mod+Shift+2 { move-window-to-workspace 2; } - Mod+Shift+3 { move-window-to-workspace 3; } - Mod+Shift+4 { move-window-to-workspace 4; } - Mod+Shift+5 { move-window-to-workspace 5; } - Mod+Shift+6 { move-window-to-workspace 6; } - Mod+Shift+7 { move-window-to-workspace 7; } - Mod+Shift+8 { move-window-to-workspace 8; } - Mod+Shift+9 { move-window-to-workspace 9; } + Mod+Shift+1 { move-window-to-workspace 2; } + Mod+Shift+2 { move-window-to-workspace 3; } + Mod+Shift+3 { move-window-to-workspace 4; } + Mod+Shift+4 { move-window-to-workspace 5; } + Mod+Shift+5 { move-window-to-workspace 6; } + Mod+Shift+6 { move-window-to-workspace 7; } + Mod+Shift+7 { move-window-to-workspace 8; } + Mod+Shift+8 { move-window-to-workspace 9; } + Mod+Shift+9 { move-window-to-workspace 10; } Mod+Print { spawn "screenshot"; } - Mod+M { move-window-to-workspace "minimized"; } - Mod+Shift+M { focus-workspace "minimized"; } + // focus=false or focus follows the window into the stash — the opposite of + // minimizing. + Mod+M { move-window-to-workspace "minimized" focus=false; } + Mod+Shift+M { spawn "window-restore"; } Mod+Shift+E { spawn "hyprlock"; } Mod+Shift+P { spawn "powermenu"; }