summary refs log tree commit diff stats
path: root/user/emacs/init.el
diff options
context:
space:
mode:
authorAlan Pearce2023-04-02 20:27:53 +0200
committerAlan Pearce2023-04-02 20:27:53 +0200
commitc6440f3e932e936ce603a977c725f554c9ce44bf (patch)
tree7c363282d8fdd11d1c5f8d98f6743594cf717282 /user/emacs/init.el
parent14e573db264debf99046142ce9a72f41ccdf3baa (diff)
downloadnixfiles-c6440f3e932e936ce603a977c725f554c9ce44bf.tar.lz
nixfiles-c6440f3e932e936ce603a977c725f554c9ce44bf.tar.zst
nixfiles-c6440f3e932e936ce603a977c725f554c9ce44bf.zip
emacs: re-implement auto dark/light mode switching on macOS
Since I'm not using EmacsMacPort any more, the function
`(mac-application-state)` isn't defined.  However, we can use launchd
to tell us when the system preferences change and then ask whether
light or dark mode is active
Diffstat (limited to 'user/emacs/init.el')
-rw-r--r--user/emacs/init.el17
1 files changed, 2 insertions, 15 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index b6162b76..ae17d7c5 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -80,22 +80,9 @@
                       modus-themes-to-toggle `(,light-mode-theme ,dark-mode-theme))
                 (load-theme light-mode-theme :noconfirm :noenable)
                 (load-theme dark-mode-theme :noconfirm :noenable)
-                (defun my/set-dark-or-light-theme ()
-                  (interactive)
-                  (let ((appearance (plist-get (mac-application-state) :appearance)))
-                    (mapc #'disable-theme custom-enabled-themes)
-                    (cond ((equal appearance "NSAppearanceNameAqua")
-                           (enable-theme light-mode-theme))
-                          ((equal appearance "NSAppearanceNameDarkAqua")
-                           (enable-theme dark-mode-theme)))))
-                (add-hook 'mac-effective-appearance-change-hook #'my/set-dark-or-light-theme)
-                (if (fboundp #'mac-application-state)
-                    (my/set-dark-or-light-theme)
-                  (enable-theme light-mode-theme)))))
+                (enable-theme light-mode-theme))))
   (if (eq window-system 'x)
-      (setq-default line-spacing 0.2))
-  (setq frame-background-mode 'light)
-  (mapc 'frame-set-background-mode (frame-list)))
+      (setq-default line-spacing 0.2)))
 
 (setq font-lock-maximum-decoration '((t . 1)))