diff --git a/configs/nixos/modules/desktop/session/hyprland/default.nix b/configs/nixos/modules/desktop/session/hyprland/default.nix index 51a1ff3..4189817 100644 --- a/configs/nixos/modules/desktop/session/hyprland/default.nix +++ b/configs/nixos/modules/desktop/session/hyprland/default.nix @@ -9,6 +9,7 @@ config = lib.mkIf config.modules.desktop.session.hyprland.enable { registry.keybind.${config.networking.hostName} = lib.mkMerge [ + # Generate numeric workspace focus keybinds. (lib.listToAttrs ( map (workspace: { name = "hyprland-workspace-${toString workspace}"; @@ -21,39 +22,41 @@ }; }) (lib.range 1 9) )) - { - hyprland-focus-left = { - keys = "SUPER + H"; - action = { - kind = "focus"; - direction = "left"; - }; - }; - - hyprland-focus-down = { - keys = "SUPER + J"; - action = { - kind = "focus"; - direction = "down"; - }; - }; - - hyprland-focus-up = { - keys = "SUPER + K"; - action = { - kind = "focus"; - direction = "up"; - }; - }; - - hyprland-focus-right = { - keys = "SUPER + L"; - action = { - kind = "focus"; - direction = "right"; - }; - }; - } + # Generate directional focus keybinds from Vim movement keys. + (lib.listToAttrs ( + map + ( + { direction, key }: + { + name = "hyprland-focus-${direction}"; + value = { + keys = "SUPER + ${key}"; + action = { + kind = "focus"; + inherit direction; + }; + }; + } + ) + [ + { + key = "H"; + direction = "left"; + } + { + key = "J"; + direction = "down"; + } + { + key = "K"; + direction = "up"; + } + { + key = "L"; + direction = "right"; + } + ] + )) ]; # This program integration owns the session, portals, and polkit, launched