From 2f2fdb2b31bcadf542338f812401c01f35265340 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 10 Oct 2026 15:07:17 -0400 Subject: [PATCH] refactor(hyprland): inline keybind rendering --- .../desktop/session/hyprland/default.nix | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/configs/nixos/modules/desktop/session/hyprland/default.nix b/configs/nixos/modules/desktop/session/hyprland/default.nix index f68ba07..e73441e 100644 --- a/configs/nixos/modules/desktop/session/hyprland/default.nix +++ b/configs/nixos/modules/desktop/session/hyprland/default.nix @@ -4,24 +4,6 @@ ... }: # The Hyprland compositor. -let - mkBind = keybind: { - _args = [ - keybind.keys - (mkAction keybind.action) - ]; - }; - - mkAction = - action: - lib.generators.mkLuaInline ({ exec = "hl.dsp.exec_cmd(${toLua action.command})"; }.${action.kind}); - - keybinds = lib.attrValues ( - lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind - ); - - toLua = lib.generators.toLua { }; -in { options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor"; @@ -53,7 +35,12 @@ in settings = { config.general.layout = "dwindle"; - bind = map mkBind keybinds; + bind = lib.mapAttrsToList (_name: keybind: { + _args = [ + keybind.keys + (lib.generators.mkLuaInline "hl.dsp.exec_cmd(${lib.generators.toLua { } keybind.action.command})") + ]; + }) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind); }; }; };