emacs: load dark theme on startup if OS dark mode enabled
1 file changed, 9 insertions(+), 3 deletions(-)
changed files
M user/settings/emacs/init.el → user/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)