From 478081af928e1557b325f4a4cbd5b67f079660d2 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Wed, 25 Sep 2024 19:41:02 +0530 Subject: Adding nnn file manager. Adding bspwm bindings to sxhkd only if the module is enabled. --- modules/desktop/window-manager/sxhkd/default.nix | 93 ++++++++---------------- 1 file changed, 30 insertions(+), 63 deletions(-) (limited to 'modules/desktop/window-manager/sxhkd/default.nix') diff --git a/modules/desktop/window-manager/sxhkd/default.nix b/modules/desktop/window-manager/sxhkd/default.nix index 3673b48..decad25 100644 --- a/modules/desktop/window-manager/sxhkd/default.nix +++ b/modules/desktop/window-manager/sxhkd/default.nix @@ -12,68 +12,35 @@ let modKey = "alt"; createKeybinding = keybinding: description: "# ${description}\n${modKey} + ${keybinding}"; - in { - ${(createKeybinding - "s" - "Show keybindings.")} - = pkgs.writeShellScript - "show-keybindings.sh" - (builtins.readFile ./scripts/show-keybindings.sh); - - ${(createKeybinding - "r" - "Launch rofi.")} - = "rofi -show run"; - - ${(createKeybinding - "t" - "Launch terminal.")} - = config.desktop.terminal.default; - - ${(createKeybinding - "f" - "Launch File Explorer.")} - = "${config.desktop.terminal.default} -t 'File Explorer' --class 'popup' -e lf"; - - ${(createKeybinding - "q" - "Kill current window.")} - = "bspc node -c"; - - ${(createKeybinding - "{1-9,0}" - "Switch workspace.")} - = "bspc desktop -f {1-9,10}"; - - ${(createKeybinding - "shift + {1-9,0}" - "Move window to workspace.")} - = "bspc node -d {1-9,10} --follow"; - - ${(createKeybinding - "{n,d,m}" - "Set current window mode (tiled, floating, fullscreen).")} - = "bspc node focused -t {tiled,floating,fullscreen}"; - - ${(createKeybinding - "{_,shift + }{h,j,k,l}" - "Navigate between windows.")} - = "bspc node --{focus,swap} {west,south,north,east}"; - - # the indentation for each line is required to work with the help prompt - ${(createKeybinding - "ctrl + {h,j,k,l}" - "Resize current window.")} - = '' - {bspc node @parent/second -z left -20 0; \ - bspc node @parent/first -z right -20 0, \ - bspc node @parent/second -z top 0 +20; \ - bspc node @parent/first -z bottom 0 +20, \ - bspc node @parent/first -z bottom 0 -20; \ - bspc node @parent/second -z top 0 -20, \ - bspc node @parent/first -z right +20 0; \ - bspc node @parent/second -z left +20 0} - ''; - }; + in lib.mkMerge [ + ( + if config.desktop.window-manager.bspwm.enable then + (import ./keybindings/bspwm.nix { inherit pkgs createKeybinding; }) + else {} + ) + { + ${(createKeybinding + "s" + "Show keybindings.")} + = pkgs.writeShellScript + "keybindings.sh" + (builtins.readFile ./scripts/keybindings.sh); + + ${(createKeybinding + "r" + "Application launcher.")} + = config.desktop.popup-manager.application-launcher.default; + + ${(createKeybinding + "t" + "Launch terminal.")} + = config.desktop.terminal.default; + + ${(createKeybinding + "f" + "Launch File Manager.")} + = "${config.desktop.terminal.default} -t 'File Manager' --class popup -e ${config.tools.file-manager.default}"; + } + ]; }; } -- cgit v1.2.3