Skip to content

Instantly share code, notes, and snippets.

@binarynoise
Last active September 18, 2023 14:52
Show Gist options
  • Save binarynoise/492f243cdcb8902f85509fb47629802d to your computer and use it in GitHub Desktop.
Save binarynoise/492f243cdcb8902f85509fb47629802d to your computer and use it in GitHub Desktop.
Kitty Theme Listener

Automatically make kitty toggle between light and dark themes to follow the theme you set. Just put it into autostart.

#!/usr/bin/bash
IFS=$'\n'
changeTheme() {
case "$1" in
*dark*)
kitty +kitten themes --reload-in all Tango Dark
;;
*light* | *default*)
kitty +kitten themes --reload-in all Tango Light
;;
esac
}
changeTheme "$(dconf read /org/x/apps/portal/color-scheme)"
dconf watch /org/x/apps/portal/color-scheme |
grep --line-buffered -ve '/org/x/apps/portal/color-scheme' -e '^\s*$' |
while read -r line; do
changeTheme "$line"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment