refactor(hyprland): add keybind action shape
This commit is contained in:
@@ -14,8 +14,11 @@ in
|
|||||||
config = lib.mkIf config.modules.desktop.apps.ghostty.enable {
|
config = lib.mkIf config.modules.desktop.apps.ghostty.enable {
|
||||||
registry.keybind.${config.networking.hostName}.ghostty = {
|
registry.keybind.${config.networking.hostName}.ghostty = {
|
||||||
keys = "SUPER + Return";
|
keys = "SUPER + Return";
|
||||||
|
action = {
|
||||||
|
kind = "exec";
|
||||||
command = "${pkgs.ghostty}/bin/ghostty";
|
command = "${pkgs.ghostty}/bin/ghostty";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
home-manager.users.${user}.home.packages = [ pkgs.ghostty ];
|
home-manager.users.${user}.home.packages = [ pkgs.ghostty ];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,9 +8,14 @@ let
|
|||||||
mkBind = keybind: {
|
mkBind = keybind: {
|
||||||
_args = [
|
_args = [
|
||||||
keybind.keys
|
keybind.keys
|
||||||
(lib.generators.mkLuaInline "hl.dsp.exec_cmd(${toLua keybind.command})")
|
(mkAction keybind.action)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkAction =
|
||||||
|
action:
|
||||||
|
lib.generators.mkLuaInline ({ exec = "hl.dsp.exec_cmd(${toLua action.command})"; }.${action.kind});
|
||||||
|
|
||||||
keybinds = lib.attrValues (
|
keybinds = lib.attrValues (
|
||||||
lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind
|
lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,6 +15,14 @@
|
|||||||
description = "Sets the key chord for this desktop keybind.";
|
description = "Sets the key chord for this desktop keybind.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
action = lib.mkOption {
|
||||||
|
type = lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
kind = lib.mkOption {
|
||||||
|
type = lib.types.enum [ "exec" ];
|
||||||
|
description = "Selects the keybind action kind.";
|
||||||
|
};
|
||||||
|
|
||||||
command = lib.mkOption {
|
command = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
example = "ghostty";
|
example = "ghostty";
|
||||||
@@ -22,4 +30,8 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
description = "Declares the action this keybind runs.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user