aboutsummaryrefslogtreecommitdiffstats
path: root/modules/desktop/niri/keybindings.nix
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar+git@gmail.com>2026-08-24 04:47:45 +0530
committerArpit Chakladar <arpitchakladar+git@gmail.com>2026-08-29 03:50:29 +0530
commit0bf2f48b23b34c61729618ec1643c18d9a61ce78 (patch)
tree11b0444084f6d12ad80d93eb12e4fd04a6d6a9f7 /modules/desktop/niri/keybindings.nix
parentd1e9362085cb9564ff7323cef1612d48b16eb40d (diff)
downloadhome-manager-config-0bf2f48b23b34c61729618ec1643c18d9a61ce78.tar.gz
home-manager-config-0bf2f48b23b34c61729618ec1643c18d9a61ce78.zip
desktop: switched to niri from hyprland
- window manager hopping now goes to niri from hyprland - added niri configuration closely resembling the keybindings and visual appearence as before - updated all other modules like waybar to use niri instead of hyprland
Diffstat (limited to 'modules/desktop/niri/keybindings.nix')
-rw-r--r--modules/desktop/niri/keybindings.nix120
1 files changed, 120 insertions, 0 deletions
diff --git a/modules/desktop/niri/keybindings.nix b/modules/desktop/niri/keybindings.nix
new file mode 100644
index 0000000..5fd07fe
--- /dev/null
+++ b/modules/desktop/niri/keybindings.nix
@@ -0,0 +1,120 @@
+{
+ config,
+ lib,
+ ...
+}:
+let
+ workspaceBinds =
+ lib.concatMapStringsSep "\n"
+ (
+ { key, workspace }:
+ ''
+ Mod+${key} { focus-workspace "${workspace}"; }
+ Mod+Shift+${key} { move-column-to-workspace "${workspace}"; }''
+ )
+ [
+ {
+ key = "1";
+ workspace = "1";
+ }
+ {
+ key = "2";
+ workspace = "2";
+ }
+ {
+ key = "3";
+ workspace = "3";
+ }
+ {
+ key = "4";
+ workspace = "4";
+ }
+ {
+ key = "5";
+ workspace = "5";
+ }
+ {
+ key = "6";
+ workspace = "6";
+ }
+ {
+ key = "7";
+ workspace = "7";
+ }
+ {
+ key = "8";
+ workspace = "8";
+ }
+ {
+ key = "9";
+ workspace = "9";
+ }
+ {
+ key = "0";
+ workspace = "10";
+ }
+ ];
+in
+{
+ config.wayland.windowManager.niri.extraConfig = ''
+ binds {
+ // Niri defaults retained alongside the established launch and close bindings.
+ Mod+Shift+Slash { show-hotkey-overlay; }
+ Mod+O repeat=false { toggle-overview; }
+ Mod+Q repeat=false { close-window; }
+ Mod+Shift+Q repeat=false { close-window; }
+
+ ${lib.optionalString config.desktop.enable ''Mod+R hotkey-overlay-title="Run an Application: rofi" { spawn "${lib.getExe config.desktop.rofi.package}" "-show" "drun"; }''}
+ ${lib.optionalString config.terminal.kitty.enable ''
+ Mod+Return hotkey-overlay-title="Open a Terminal: kitty" { spawn "${lib.getExe config.terminal.kitty.package}"; }
+ Mod+T { spawn "${lib.getExe config.terminal.kitty.package}"; }''}
+ ${lib.optionalString (config.terminal.kitty.enable && config.file-management.yazi.enable)
+ ''Mod+F { spawn "${lib.getExe config.terminal.kitty.package}" "--class" "yazi" "--title" "Yazi" "-e" "${lib.getExe config.file-management.yazi.package}"; }''
+ }
+
+ // Niri's column/window-aware directional navigation.
+ Mod+H { focus-column-left; }
+ Mod+J { focus-window-down; }
+ Mod+K { focus-window-up; }
+ Mod+L { focus-column-right; }
+ Mod+Ctrl+H { move-column-left; }
+ Mod+Ctrl+J { move-window-down; }
+ Mod+Ctrl+K { move-window-up; }
+ Mod+Ctrl+L { move-column-right; }
+
+ // Preserve the old Shift movement muscle memory as aliases.
+ Mod+Shift+H { move-column-left; }
+ Mod+Shift+J { move-window-down; }
+ Mod+Shift+K { move-window-up; }
+ Mod+Shift+L { move-column-right; }
+
+ Mod+D { toggle-window-floating; }
+ Mod+V { toggle-window-floating; }
+ Mod+M { fullscreen-window; }
+ Mod+Equal { set-column-width "+10%"; }
+ Mod+Minus { set-column-width "-10%"; }
+ Mod+U { focus-workspace-down; }
+ Mod+I { focus-workspace-up; }
+ Mod+Ctrl+U { move-column-to-workspace-down; }
+ Mod+Ctrl+I { move-column-to-workspace-up; }
+ Mod+W { toggle-column-tabbed-display; }
+
+ ${workspaceBinds}
+
+ ${lib.optionalString config.system.brightnessctl.enable ''
+ XF86MonBrightnessDown allow-when-locked=true { spawn "${lib.getExe config.system.brightnessctl.package}" "set" "5%-"; }
+ XF86MonBrightnessUp allow-when-locked=true { spawn "${lib.getExe config.system.brightnessctl.package}" "set" "+5%"; }''}
+ ${lib.optionalString config.media.pamixer.enable ''
+ XF86AudioLowerVolume allow-when-locked=true { spawn "${lib.getExe config.media.pamixer.package}" "--decrease" "5"; }
+ XF86AudioRaiseVolume allow-when-locked=true { spawn "${lib.getExe config.media.pamixer.package}" "--increase" "5"; }
+ XF86AudioMute allow-when-locked=true { spawn "${lib.getExe config.media.pamixer.package}" "--toggle-mute"; }''}
+ ${lib.optionalString config.media.playerctl.enable ''XF86AudioPlay allow-when-locked=true { spawn "${lib.getExe config.media.playerctl.package}" "play-pause"; }''}
+
+ ${lib.optionalString (config.media.grim.enable && config.media.slurp.enable)
+ ''
+ Mod+P { spawn-sh "${lib.getExe config.media.grim.package} -g \"$(${lib.getExe config.media.slurp.package})\" - | ${lib.getExe' config.desktop.wl-clipboard.package "wl-copy"}"; }
+ Mod+Shift+P { spawn-sh "mkdir -p \"$HOME/Pictures/Screenshots\" && ${lib.getExe config.media.grim.package} -g \"$(${lib.getExe config.media.slurp.package})\" \"$HOME/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).png\""; }''
+ }
+ }
+ '';
+}