summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2023-04-05 17:30:38 +0200
committerAlan Pearce2023-04-05 17:30:38 +0200
commitafc5b101c15faa2e2759e8c11fbdf5c17d0008d8 (patch)
tree519b09d002c77008a9659e9429e658a1796791fc
parentf83da46fdc6558f072b6cbadc58eb8e1e8775a79 (diff)
downloadnixfiles-afc5b101c15faa2e2759e8c11fbdf5c17d0008d8.tar.lz
nixfiles-afc5b101c15faa2e2759e8c11fbdf5c17d0008d8.tar.zst
nixfiles-afc5b101c15faa2e2759e8c11fbdf5c17d0008d8.zip
darwin: fix auto-dark-light-mode not changing emacs theme
-rw-r--r--user/settings/darwin.nix12
1 files changed, 10 insertions, 2 deletions
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
                     }