From ccf4a18c8683aaaf868d61dcae6fb433b43eee38 Mon Sep 17 00:00:00 2001 From: Anton Volnuhin Date: Thu, 6 Aug 2026 05:04:05 +0300 Subject: [PATCH] kitty: match any prefix of the themes kitten, not just "themes" `kitten theme` runs the themes kitten -- kitty accepts unambiguous prefixes -- but the shim tested `$argv[1] = themes` exactly, so that spelling skipped the capture and re-apply entirely. Before the theme-mode work that was harmless, since nothing rewrote the automatic theme files; now the next regeneration reverts whatever was just chosen, which is why picking a theme stopped sticking. Accept any prefix of "themes" at least two characters long. Verified that themes/theme/them/th all trigger and icat still does not. --- .../kitty/theme-modes/private_dark.conf | 56 ++++++++----------- .../functions/private_kitten.fish | 14 ++++- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/private_dot_config/kitty/theme-modes/private_dark.conf b/private_dot_config/kitty/theme-modes/private_dark.conf index 8ba5d9a..acbd293 100644 --- a/private_dot_config/kitty/theme-modes/private_dark.conf +++ b/private_dot_config/kitty/theme-modes/private_dark.conf @@ -1,37 +1,29 @@ -# 1984 theme by Bertie Blackman, https://github.com/covertbert/iterm2-1984/ - -foreground #ffffff -background #0d0f31 -selection_foreground #000000 -selection_background #00d5eb -color0 #000000 -color1 #ff16b0 -color2 #b3f361 -color3 #ffea16 -color4 #46bdff -color5 #f806fa -color6 #59e1e3 -color7 #feffff -color8 #000000 -color9 #ff16b0 -color10 #b3f361 -color11 #ffea16 -color12 #46bdff -color13 #f806fa -color14 #6be4e6 -color15 #feffff - -# URL styles -url_color #f806fa -url_style single - -# Cursor styles -cursor #59e1e3 +background #090200 +foreground #a4a1a1 +cursor #a4a1a1 +selection_background #494542 +color0 #090200 +color8 #5b5754 +color1 #da2c20 +color9 #e8bacf +color2 #00a152 +color10 #3a3332 +color3 #fcec02 +color11 #494542 +color4 #00a0e4 +color12 #7f7c7b +color5 #a06994 +color13 #d6d4d3 +color6 #b5e4f4 +color14 #ccab53 +color7 #a4a1a1 +color15 #f7f7f7 +selection_foreground #090200 # START_AUTOGENERATED_TAB_STYLE # Feel free to update these colors manually and remove these comments. active_tab_foreground #eeeeee -active_tab_background #00d5eb -inactive_tab_foreground #ffffff -inactive_tab_background #0a0c27 +active_tab_background #494542 +inactive_tab_foreground #a4a1a1 +inactive_tab_background #070200 # END_AUTOGENERATED_TAB_STYLE diff --git a/private_dot_config/private_fish/functions/private_kitten.fish b/private_dot_config/private_fish/functions/private_kitten.fish index 1da787b..59f41b0 100644 --- a/private_dot_config/private_fish/functions/private_kitten.fish +++ b/private_dot_config/private_fish/functions/private_kitten.fish @@ -4,6 +4,17 @@ function kitten --description 'Run kitten and restore Kitty theme overrides' set config_dir "$KITTY_CONFIG_DIRECTORY" end + # kitty accepts any unambiguous prefix of a kitten name, so `kitten theme` + # runs the themes kitten just as `kitten themes` does. Match the same way: + # an exact `= themes` test silently skips the re-apply below and the next + # regeneration then reverts the theme that was just chosen. + set -l is_themes false + if test (count $argv) -gt 0 + and test (string length -- "$argv[1]") -ge 2 + and string match -q -- "$argv[1]*" themes + set is_themes true + end + command kitten $argv set -l kitten_status $status @@ -13,8 +24,7 @@ function kitten --description 'Run kitten and restore Kitty theme overrides' # -- `kitty +kitten themes`, a keybinding, another shell -- is picked up on # its next run rather than being lost. if test $kitten_status -eq 0 - and test (count $argv) -gt 0 - and test "$argv[1]" = themes + and test $is_themes = true "$HOME/.config/kitty/apply-theme-mode.sh" "$config_dir" or return $status