dotfiles/run_after_kitty-theme-mode.sh
Anton Volnuhin 1c4e3774cf 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.
2026-08-06 03:24:48 +03:00

26 lines
858 B
Bash
Executable File

#!/bin/sh
# 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.
#
# apply-theme-mode.sh is idempotent, and defaults to `auto` when there is no
# theme-mode file, so a new machine simply follows its OS until told otherwise.
set -eu
config_dir="${KITTY_CONFIG_DIRECTORY:-$HOME/.config/kitty}"
apply="$config_dir/apply-theme-mode.sh"
# Nothing to do on machines without this kitty config applied.
[ -x "$apply" ] || exit 0
[ -d "$config_dir/theme-modes" ] || exit 0
# Never let a theming problem fail the whole apply.
if ! "$apply" "$config_dir"; then
echo "warning: could not regenerate kitty theme files" >&2
fi
exit 0