diff --git a/configs/nixos/modules/desktop/apps/ghostty.nix b/configs/nixos/modules/desktop/apps/ghostty.nix index ecf4bf7..dd07245 100644 --- a/configs/nixos/modules/desktop/apps/ghostty.nix +++ b/configs/nixos/modules/desktop/apps/ghostty.nix @@ -14,7 +14,10 @@ in config = lib.mkIf config.modules.desktop.apps.ghostty.enable { registry.keybind.${config.networking.hostName}.ghostty = { keys = "SUPER + Return"; - command = "${pkgs.ghostty}/bin/ghostty"; + action = { + kind = "exec"; + command = "${pkgs.ghostty}/bin/ghostty"; + }; }; home-manager.users.${user}.home.packages = [ pkgs.ghostty ]; diff --git a/configs/nixos/modules/desktop/session/hyprland/default.nix b/configs/nixos/modules/desktop/session/hyprland/default.nix index 4c3cb16..f68ba07 100644 --- a/configs/nixos/modules/desktop/session/hyprland/default.nix +++ b/configs/nixos/modules/desktop/session/hyprland/default.nix @@ -8,9 +8,14 @@ let mkBind = keybind: { _args = [ 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 ( lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind ); diff --git a/configs/nixos/registry/keybind.nix b/configs/nixos/registry/keybind.nix index b37400e..1166386 100644 --- a/configs/nixos/registry/keybind.nix +++ b/configs/nixos/registry/keybind.nix @@ -15,10 +15,22 @@ description = "Sets the key chord for this desktop keybind."; }; - command = lib.mkOption { - type = lib.types.str; - example = "ghostty"; - description = "Command executed by this 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 { + type = lib.types.str; + example = "ghostty"; + description = "Command executed by this keybind."; + }; + }; + }; + description = "Declares the action this keybind runs."; }; }; };