Make kitty terminal emulator aware macOS system appearance change. But not perfect, since this script is not "listening" change event, but rather be triggered by new shell creation.
- pick two theme conf, one for light (basic-light.conf here) and one for dark (basic-dark.conf)
- create two file inside
KITTY_CONFIG_DIRECTORY
(~/.config/kitty here), macos-launch-services-cmdline-dark.conf and macos-launch-services-cmdline-light.conf - tweak macos-launch-services-cmdline-*.conf, add kitty.conf and theme.conf, note that args should use full path.
- make
kitty-appearance-switch.zsh
sourced automatically by adding it to~/.zshrc
Simply source an zsh script(kitty-appearance-switch.zsh) when a new shell starts.
It does folling things:
- check and only apply to macOS(darwin) system.
- read AppleInterfaceStyle to tell if "Dark Mode" is on.
- conditionally symlink corresponding cmdline file inside
KITTY_CONFIG_DIRECTORY
. - tell all exising kitty instance use new color theme through kitty set_colors action
extacted from my kitty dotfile, updates will goes to the repo.