From 19185ef0dca6e4bd0e309b867c02b76da75c483f Mon Sep 17 00:00:00 2001 From: UnbreakableMJ Date: Thu, 25 Jun 2026 22:25:39 +0300 Subject: [PATCH] fix(niri): Super+Space switches keyboard layout (us/ar) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Niri grabs key events for its own binds before xkbcommon's group-toggle action fires, so the xkb `grp:ctrl_space_toggle` option — which does switch layouts under X11/LeftWM — was a no-op in Niri. Super+Space did nothing. Add Niri's native `switch-layout "next"` action on Mod+Space (= Super+Space) and document the X11-vs-Niri difference at the xkb block. The X11 paths (home.keyboard, services.xserver.xkb) keep grp:ctrl_space_toggle untouched. Verified with `niri validate` (config is valid). Co-Authored-By: Claude Opus 4.8 --- users/mj/home.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/users/mj/home.nix b/users/mj/home.nix index 56f55c4..37d1a42 100755 --- a/users/mj/home.nix +++ b/users/mj/home.nix @@ -1212,6 +1212,10 @@ in keyboard { xkb { layout "us,ar" + // grp:ctrl_space_toggle drives switching under X11/LeftWM, but + // is a no-op in Niri (Niri grabs keys for its own binds before + // xkbcommon's group-toggle action fires). The Mod+Space bind in + // `binds` below does the switching here. Kept for X11 parity. options "grp:ctrl_space_toggle" } } @@ -1240,6 +1244,10 @@ in // (Minus, Equal, Return) elsewhere in the bind table. Mod+Shift+Slash hotkey-overlay-title="Show Important Hotkeys" { show-hotkey-overlay; } + // Keyboard layout — toggle us ⇄ ar. Niri's native action (see the xkb + // note above for why the grp: toggle alone doesn't switch here). + Mod+Space hotkey-overlay-title="Switch Keyboard Layout (us/ar)" { switch-layout "next"; } + // Applications Mod+Return hotkey-overlay-title="Open a Terminal: alacritty" { spawn "alacritty"; } Mod+D hotkey-overlay-title="Run an Application: anyrun" { spawn "anyrun"; }