From afc5b101c15faa2e2759e8c11fbdf5c17d0008d8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Apr 2023 17:30:38 +0200 Subject: darwin: fix auto-dark-light-mode not changing emacs theme --- user/settings/darwin.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'user/settings') diff --git a/user/settings/darwin.nix b/user/settings/darwin.nix index 75df5271..e3c5979c 100644 --- a/user/settings/darwin.nix +++ b/user/settings/darwin.nix @@ -82,6 +82,10 @@ enable = true; config = { WatchPaths = [ "${config.home.homeDirectory}/Library/Preferences/.GlobalPreferences.plist" ]; + StandardOutputPath = "/dev/null"; + StandardErrorPath = "/dev/null"; + RunAtLoad = true; + KeepAlive = false; ProgramArguments = [ "/bin/sh" ( @@ -90,17 +94,21 @@ pkgs.writeShellScript "toggle-dark-light-mode" '' + wait4path /nix if defaults read -g AppleInterfaceStyle &>/dev/null ; then MODE="dark" else MODE="light" fi + emacsclient="${config.programs.emacs.finalPackage}/bin/emacsclient" emacsSwitchTheme () { if pgrep -q Emacs; then if [[ $MODE == "dark" ]]; then - emacsclient --eval "(modus-themes-load-theme (cadr modus-themes-to-toggle))" + $emacsclient --eval "(modus-themes-load-theme (cadr modus-themes-to-toggle))" \ + --eval "(modify-all-frames-parameters '((ns-appearance '$MODE)))" elif [[ $MODE == "light" ]]; then - emacsclient --eval "(modus-themes-load-theme (car modus-themes-to-toggle))" + $emacsclient --eval "(modus-themes-load-theme (car modus-themes-to-toggle))" \ + --eval "(modify-all-frames-parameters '((ns-appearance '$MODE)))" fi fi } -- cgit 1.4.1