From 8ae256b2e5d3facdfa6cedaa1693c6bbab5ba224 Mon Sep 17 00:00:00 2001 From: alexion Date: Sun, 11 Oct 2026 14:49:19 -0400 Subject: [PATCH] refactor(hyprland): inline directional key list --- .../desktop/session/hyprland/default.nix | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/configs/nixos/modules/desktop/session/hyprland/default.nix b/configs/nixos/modules/desktop/session/hyprland/default.nix index da16e5a..16679da 100644 --- a/configs/nixos/modules/desktop/session/hyprland/default.nix +++ b/configs/nixos/modules/desktop/session/hyprland/default.nix @@ -4,26 +4,6 @@ ... }: # The Hyprland compositor. -let - directions = [ - { - key = "H"; - direction = "left"; - } - { - key = "J"; - direction = "down"; - } - { - key = "K"; - direction = "up"; - } - { - key = "L"; - direction = "right"; - } - ]; -in { options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor"; @@ -60,33 +40,53 @@ in ] ) (lib.range 1 9) )) + # Generate directional keybinds. (lib.listToAttrs ( - lib.concatMap ( - { direction, key }: + lib.concatMap + ( + { direction, key }: + [ + { + name = "hyprland-focus-${direction}"; + value = { + keys = "SUPER + ${key}"; + action = { + kind = "focus"; + inherit direction; + }; + }; + } + { + name = "hyprland-move-${direction}"; + value = { + keys = "SUPER + SHIFT + ${key}"; + action = { + kind = "move-window"; + inherit direction; + }; + }; + } + ] + ) [ { - name = "hyprland-focus-${direction}"; - value = { - keys = "SUPER + ${key}"; - action = { - kind = "focus"; - inherit direction; - }; - }; + key = "H"; + direction = "left"; } { - name = "hyprland-move-${direction}"; - value = { - keys = "SUPER + SHIFT + ${key}"; - action = { - kind = "move-window"; - inherit direction; - }; - }; + key = "J"; + direction = "down"; + } + { + key = "K"; + direction = "up"; + } + { + key = "L"; + direction = "right"; } ] - ) directions )) ];