kitty: put the grok themes in the picker, move the mode store aside
`kitten themes` treats every .conf in <config-dir>/themes as a user theme, which the mode system's canonical store was sitting in -- so the picker was offering three bogus entries named light, dark and no-preference, and had been since that store was introduced. Move the store to ./theme-modes so ./themes means only what the kitten means by it, and repoint apply-theme-mode.sh, the kitten shim, the run_after hook and the test at the new path. GrokNight and GrokDay move into ./themes with the ## name/author/ license/upstream/blurb header the kitten reads, so they now show up in `kitten themes` and `--dump-theme` resolves them. theme-modes/dark.conf carries the #202020 theme that was already on disk: the file had to be re-added at its new path, so that drift comes along with it.
This commit is contained in:
parent
c2d0485320
commit
1c4e3774cf
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Regenerate the *-theme.auto.conf files kitty reads at startup from the
|
||||
# canonical themes in ./themes, honouring the mode recorded in ./theme-mode:
|
||||
# canonical themes in ./theme-modes, honouring the mode recorded in ./theme-mode:
|
||||
#
|
||||
# auto every appearance keeps its own theme, so kitty follows the OS
|
||||
# light every appearance gets the light theme, so kitty stays light
|
||||
@ -10,7 +10,8 @@
|
||||
# kitty gives the automatic theme files priority over everything else -- includes
|
||||
# and even --override -- so pinning a mode means writing the wanted theme into
|
||||
# whichever file the OS makes kitty pick. That is why the real themes live in
|
||||
# ./themes and these three files are generated.
|
||||
# ./theme-modes and these three files are generated. (./themes is separate:
|
||||
# that is where the themes kitten looks for user themes.)
|
||||
|
||||
set -eu
|
||||
|
||||
@ -32,7 +33,7 @@ file_mode() {
|
||||
|
||||
script_dir="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||
config_dir=${1:-"$script_dir"}
|
||||
canonical_dir="$config_dir/themes"
|
||||
canonical_dir="$config_dir/theme-modes"
|
||||
mode_file="$config_dir/theme-mode"
|
||||
|
||||
mode=auto
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Behavioural regression for the remembered light/dark mode:
|
||||
# - apply-theme-mode.sh generates the automatic theme files from ./themes
|
||||
# - apply-theme-mode.sh generates the automatic theme files from ./theme-modes
|
||||
# - a pinned mode puts one theme in all three, so kitty starts in it
|
||||
# - `theme auto` restores per-appearance themes without losing any
|
||||
# - `kitten themes` changes are captured even while a mode is pinned
|
||||
@ -16,7 +16,7 @@ trap 'rm -rf "$tmpdir"' EXIT HUP INT TERM
|
||||
|
||||
config_dir="$tmpdir/config"
|
||||
fake_bin="$tmpdir/bin"
|
||||
mkdir -p "$config_dir/themes" "$fake_bin"
|
||||
mkdir -p "$config_dir/theme-modes" "$fake_bin"
|
||||
|
||||
DARK='#111111'
|
||||
LIGHT='#eeeeee'
|
||||
@ -24,11 +24,11 @@ NOPREF='#222222'
|
||||
NEW_LIGHT='#abcdef'
|
||||
|
||||
printf 'background %s\nmacos_titlebar_color background\n' "$DARK" \
|
||||
>"$config_dir/themes/dark.conf"
|
||||
>"$config_dir/theme-modes/dark.conf"
|
||||
printf 'background %s\nmacos_titlebar_color background\n' "$LIGHT" \
|
||||
>"$config_dir/themes/light.conf"
|
||||
>"$config_dir/theme-modes/light.conf"
|
||||
printf 'background %s\nmacos_titlebar_color background\n' "$NOPREF" \
|
||||
>"$config_dir/themes/no-preference.conf"
|
||||
>"$config_dir/theme-modes/no-preference.conf"
|
||||
|
||||
bg() {
|
||||
awk '/^background/ { print $2; exit }' "$1"
|
||||
@ -103,7 +103,7 @@ printf '#!/bin/sh\nexit 0\n' >"$fake_bin/kitty"
|
||||
chmod +x "$fake_bin/kitten" "$fake_bin/kitty"
|
||||
|
||||
run_fish light 'theme dark >/dev/null; kitten themes' >/dev/null
|
||||
expect "captured new light theme" "$config_dir/themes/light.conf" "$NEW_LIGHT"
|
||||
expect "captured new light theme" "$config_dir/theme-modes/light.conf" "$NEW_LIGHT"
|
||||
expect "pin still held after kitten themes" \
|
||||
"$config_dir/light-theme.auto.conf" "$DARK"
|
||||
[ "$(tr -d ' \n' <"$config_dir/theme-mode")" = dark ] || {
|
||||
@ -115,7 +115,7 @@ run_fish light 'theme light >/dev/null'
|
||||
expect "new light theme is used once selected" \
|
||||
"$config_dir/light-theme.auto.conf" "$NEW_LIGHT"
|
||||
expect "dark theme survived the whole exchange" \
|
||||
"$config_dir/themes/dark.conf" "$DARK"
|
||||
"$config_dir/theme-modes/dark.conf" "$DARK"
|
||||
|
||||
# --- a bare `theme` records auto when it lands on the macOS appearance ----
|
||||
echo auto >"$config_dir/theme-mode"
|
||||
|
||||
29
private_dot_config/kitty/theme-modes/private_dark.conf
Normal file
29
private_dot_config/kitty/theme-modes/private_dark.conf
Normal file
@ -0,0 +1,29 @@
|
||||
background #202020
|
||||
foreground #adadad
|
||||
cursor #ffffff
|
||||
selection_background #1a3272
|
||||
color0 #000000
|
||||
color8 #545454
|
||||
color1 #fa5355
|
||||
color9 #fb7172
|
||||
color2 #126e00
|
||||
color10 #67ff4f
|
||||
color3 #c2c300
|
||||
color11 #ffff00
|
||||
color4 #4581eb
|
||||
color12 #6d9df1
|
||||
color5 #fa54ff
|
||||
color13 #fb82ff
|
||||
color6 #33c2c1
|
||||
color14 #60d3d1
|
||||
color7 #adadad
|
||||
color15 #eeeeee
|
||||
selection_foreground #202020
|
||||
|
||||
# START_AUTOGENERATED_TAB_STYLE
|
||||
# Feel free to update these colors manually and remove these comments.
|
||||
active_tab_foreground #eeeeee
|
||||
active_tab_background #1a3272
|
||||
inactive_tab_foreground #adadad
|
||||
inactive_tab_background #1a1a1a
|
||||
# END_AUTOGENERATED_TAB_STYLE
|
||||
@ -1,3 +1,9 @@
|
||||
## name: GrokDay
|
||||
## author: xAI (grok build), ported by Anton
|
||||
## license: see https://github.com/xai-org/grok-build
|
||||
## upstream: https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-pager-render/src/theme/grokday.rs
|
||||
## blurb: The GrokDay theme from grok build's TUI: light counterpart with deepened accents.
|
||||
|
||||
# GrokDay — neutral light gray base with deepened accents.
|
||||
#
|
||||
# Ported from grok build's TUI theme:
|
||||
@ -1,3 +1,9 @@
|
||||
## name: GrokNight
|
||||
## author: xAI (grok build), ported by Anton
|
||||
## license: see https://github.com/xai-org/grok-build
|
||||
## upstream: https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-pager-render/src/theme/groknight.rs
|
||||
## blurb: The GrokNight theme from grok build's TUI: neutral gray base with TokyoNight accents.
|
||||
|
||||
# GrokNight — neutral gray base with TokyoNight accents.
|
||||
#
|
||||
# Ported from grok build's TUI theme:
|
||||
@ -1,31 +0,0 @@
|
||||
background #1c2836
|
||||
foreground #ffffff
|
||||
cursor #bbbbbb
|
||||
selection_background #b4d5ff
|
||||
color0 #000000
|
||||
color8 #545454
|
||||
color1 #f9555f
|
||||
color9 #fa8b8e
|
||||
color2 #20af89
|
||||
color10 #34bb99
|
||||
color3 #fdf029
|
||||
color11 #ffff55
|
||||
color4 #589cf5
|
||||
color12 #589cf5
|
||||
color5 #934d95
|
||||
color13 #e75598
|
||||
color6 #1e9ee6
|
||||
color14 #3978bb
|
||||
color7 #bbbbbb
|
||||
color15 #ffffff
|
||||
selection_foreground #1c2836
|
||||
|
||||
# START_AUTOGENERATED_TAB_STYLE
|
||||
# Feel free to update these colors manually and remove these comments.
|
||||
active_tab_foreground #1c2836
|
||||
active_tab_background #2e84e6
|
||||
inactive_tab_foreground #2e84e6
|
||||
inactive_tab_background #1c2836
|
||||
# END_AUTOGENERATED_TAB_STYLE
|
||||
|
||||
macos_titlebar_color background
|
||||
@ -9,7 +9,7 @@ function kitten --description 'Run kitten and restore Kitty theme overrides'
|
||||
set is_themes true
|
||||
end
|
||||
|
||||
# The automatic theme files are generated from $config_dir/themes, so record
|
||||
# The automatic theme files are generated from $config_dir/theme-modes, so record
|
||||
# their state first: whichever one the kitten rewrites is the theme just
|
||||
# chosen for that appearance, and has to be captured before the mode is
|
||||
# re-applied over the top of it.
|
||||
@ -41,9 +41,9 @@ function kitten --description 'Run kitten and restore Kitty theme overrides'
|
||||
test "$now" = "$before[$index]"
|
||||
and continue
|
||||
|
||||
command mkdir -p "$config_dir/themes"
|
||||
command mkdir -p "$config_dir/theme-modes"
|
||||
or return $status
|
||||
command cp "$file" "$config_dir/themes/$appearance.conf"
|
||||
command cp "$file" "$config_dir/theme-modes/$appearance.conf"
|
||||
or return $status
|
||||
end
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The kitty *-theme.auto.conf files are generated from .config/kitty/themes and
|
||||
# The kitty *-theme.auto.conf files are generated from .config/kitty/theme-modes and
|
||||
# the per-machine .config/kitty/theme-mode, both of which .chezmoiignore keeps
|
||||
# out of the source state. Regenerate them here so a freshly applied machine
|
||||
# ends up with theme files kitty can read.
|
||||
@ -15,7 +15,7 @@ apply="$config_dir/apply-theme-mode.sh"
|
||||
|
||||
# Nothing to do on machines without this kitty config applied.
|
||||
[ -x "$apply" ] || exit 0
|
||||
[ -d "$config_dir/themes" ] || exit 0
|
||||
[ -d "$config_dir/theme-modes" ] || exit 0
|
||||
|
||||
# Never let a theming problem fail the whole apply.
|
||||
if ! "$apply" "$config_dir"; then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user