refactor(hyprland): inline keybind rendering
This commit is contained in:
@@ -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);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user