all repos — nixfiles @ b9379384512f40491236c6187dbc72bc8a23d513

System and user configuration, managed by nix and home-manager

darwin: auto-toggle dark/light mode in kitty
Alan Pearce alan@alanpearce.eu
Thu, 07 Sep 2023 19:21:19 +0200
commit

b9379384512f40491236c6187dbc72bc8a23d513

parent

32977f82f79baa6b632ca710f2f87d62bc28c46e

1 files changed, 12 insertions(+), 1 deletions(-)

jump to
M user/settings/darwin.nixuser/settings/darwin.nix
@@ -77,6 +77,7 @@ else                       MODE="light"
                     fi
                     emacsclient="${config.programs.emacs.finalPackage}/bin/emacsclient"
+                    kitty="${pkgs.kitty}/bin/kitty +kitten themes --reload-in=all --cache-age=-1"
                     emacsSwitchTheme () {
                       if pgrep -q Emacs; then
                         if [[  $MODE == "dark"  ]]; then
@@ -90,7 +91,17 @@ --eval "(modify-all-frames-parameters '((ns-appearance '$MODE)))"                         fi
                       fi
                     }
-                    emacsSwitchTheme $@
+                    kittySwitchTheme () {
+                      if pgrep -q kitty; then
+                        if [[  $MODE == "dark"  ]]; then
+                          $kitty 'Alabaster Dark'
+                        elif [[ $MODE == "light" ]]; then
+                          $kitty 'Alabaster'
+                        fi
+                      fi
+                    }
+                    emacsSwitchTheme
+                    kittySwitchTheme
                   ''
               )
           )