all repos — nixfiles @ 3e2d3057efe41ed558bbc3dc211cf3f814d65cb6

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

emacs: load dark theme on startup if OS dark mode enabled

Alan Pearce
commit

3e2d3057efe41ed558bbc3dc211cf3f814d65cb6

parent

3e4382d35bffa98155e6c3958356fdc3fdb9a78f

1 file changed, 9 insertions(+), 3 deletions(-)

changed files
M user/settings/emacs/init.eluser/settings/emacs/init.el
@@ -78,14 +78,13 @@ (use-package doom-themes
:if (or (daemonp) window-system) :config (progn - (load-theme 'doom-one-light :noconfirm) (doom-themes-org-config))) (let ((light-mode-theme 'doom-one-light) (dark-mode-theme 'doom-one)) (load-theme light-mode-theme :noconfirm :noenable) (load-theme dark-mode-theme :noconfirm :noenable) - (enable-theme light-mode-theme) + (defun my/switch-theme-variant (mode) (interactive (list (intern (completing-read "Make it: " '("light" "dark") nil t))))
@@ -96,7 +95,14 @@ (enable-theme dark-mode-theme))
((eq mode 'light) (disable-theme dark-mode-theme) (enable-theme light-mode-theme))) - (modify-all-frames-parameters '((ns-appearance mode))))) + (modify-all-frames-parameters '((ns-appearance mode)))) + + (my/switch-theme-variant (if (and (eq system-type 'darwin) + (string-equal + "Dark" + (string-trim-right (shell-command-to-string "defaults read -g AppleInterfaceStyle")))) + 'dark + 'light))) (use-package exec-path-from-shell :if (eq system-type 'darwin)