diff options
Diffstat (limited to 'user/settings/kitty.nix')
-rw-r--r-- | user/settings/kitty.nix | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/user/settings/kitty.nix b/user/settings/kitty.nix index 8a06a820..c80c5fbd 100644 --- a/user/settings/kitty.nix +++ b/user/settings/kitty.nix @@ -1,4 +1,5 @@ -{ pkgs +{ config +, pkgs , ... }: { @@ -24,4 +25,34 @@ include ~/.config/kitty/theme.conf ''; }; + launchd.agents.kitty-dark-light = { + enable = true; + config = { + WatchPaths = [ "${config.home.homeDirectory}/Library/Preferences/.GlobalPreferences.plist" ]; + StandardOutputPath = "/dev/null"; + StandardErrorPath = "/dev/null"; + RunAtLoad = true; + KeepAlive = false; + ProgramArguments = [ + "/bin/sh" + (toString (pkgs.writeShellScript "toggle-dark-light-mode" '' + wait4path /nix + if defaults read -g AppleInterfaceStyle &>/dev/null ; then + MODE="dark" + else + MODE="light" + fi + kitty="${pkgs.kitty}/bin/kitty +kitten themes --config-file-name=theme.conf --reload-in=all --cache-age=-1" + if pgrep -q kitty; then + if [[ $MODE == "dark" ]]; then + $kitty 'Modus Vivendi' + elif [[ $MODE == "light" ]]; then + $kitty 'Modus Operandi' + fi + fi + '' + )) + ]; + }; + }; } |