Skip to content

Commit

Permalink
kitty: add action aliases config (#6538)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmvar authored Feb 27, 2025
1 parent 0208592 commit 343646e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
17 changes: 17 additions & 0 deletions modules/programs/kitty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}";
};
Expand Down Expand Up @@ -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 = { };
Expand Down Expand Up @@ -234,6 +250,7 @@ in {
shell_integration ${cfg.shellIntegration.mode}
'')
(toKittyConfig cfg.settings)
(toKittyActionAliases cfg.actionAliases)
(toKittyKeybindings cfg.keybindings)
(toKittyEnv cfg.environment)
cfg.extraConfig
Expand Down
3 changes: 3 additions & 0 deletions tests/modules/programs/kitty/example-settings-expected.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions tests/modules/programs/kitty/example-settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"; };
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@




0 comments on commit 343646e

Please sign in to comment.