Skip to content

Instantly share code, notes, and snippets.

@binarynoise
Last active September 7, 2024 15:56
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.

Revisions

  1. binarynoise renamed this gist Sep 7, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. binarynoise revised this gist Sep 18, 2023. 1 changed file with 0 additions and 0 deletions.
    Empty file modified kitty-theme-listener.sh
    100644 → 100755
    Empty file.
  3. binarynoise revised this gist Sep 18, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    Automatically make kitty toggle between light and dark themes to follow the theme you set.
    Just put it into autostart.
  4. binarynoise created this gist Sep 18, 2023.
    22 changes: 22 additions & 0 deletions kitty-theme-listener.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/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