diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index 04dada1fa..cc7e7b4dc 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -22,6 +22,10 @@ let mkKeyValue = key: command: "map ${key} ${command}"; }; + toKittyActionAliases = lib.generators.toKeyValue { + mkKeyValue = alias_name: action: "action_alias ${alias_name} ${action}"; + }; + toKittyEnv = lib.generators.toKeyValue { mkKeyValue = name: value: "env ${name}=${value}"; }; @@ -143,6 +147,18 @@ in { description = "The font to use."; }; + actionAliases = mkOption { + type = types.attrsOf types.str; + default = { }; + description = "Define action aliases."; + example = literalExpression '' + { + "launch_tab" = "launch --cwd=current --type=tab"; + "launch_window" = "launch --cwd=current --type=os-window"; + } + ''; + }; + keybindings = mkOption { type = types.attrsOf types.str; default = { }; @@ -234,6 +250,7 @@ in { shell_integration ${cfg.shellIntegration.mode} '') (toKittyConfig cfg.settings) + (toKittyActionAliases cfg.actionAliases) (toKittyKeybindings cfg.keybindings) (toKittyEnv cfg.environment) cfg.extraConfig diff --git a/tests/modules/programs/kitty/example-settings-expected.conf b/tests/modules/programs/kitty/example-settings-expected.conf index 41a9cb772..b52d34d44 100644 --- a/tests/modules/programs/kitty/example-settings-expected.conf +++ b/tests/modules/programs/kitty/example-settings-expected.conf @@ -12,6 +12,9 @@ enable_audio_bell no scrollback_lines 10000 update_check_interval 0 +action_alias launch_tab launch --cwd=current --type=tab +action_alias launch_window launch --cwd=current --type=os-window + map ctrl+c copy_or_interrupt map ctrl+f>2 set_font_size 20 diff --git a/tests/modules/programs/kitty/example-settings.nix b/tests/modules/programs/kitty/example-settings.nix index 8b6c74ee7..cd7a9a327 100644 --- a/tests/modules/programs/kitty/example-settings.nix +++ b/tests/modules/programs/kitty/example-settings.nix @@ -24,6 +24,11 @@ "ctrl+f>2" = "set_font_size 20"; }; + actionAliases = { + "launch_tab" = "launch --cwd=current --type=tab"; + "launch_window" = "launch --cwd=current --type=os-window"; + }; + environment = { LS_COLORS = "1"; }; }; diff --git a/tests/modules/programs/kitty/null-shellIntegration-expected.conf b/tests/modules/programs/kitty/null-shellIntegration-expected.conf index df3ae5984..75386d91e 100644 --- a/tests/modules/programs/kitty/null-shellIntegration-expected.conf +++ b/tests/modules/programs/kitty/null-shellIntegration-expected.conf @@ -6,3 +6,4 @@ +