;; -*- lexical-binding: t; -*- (defvar my-light-theme 'doom-solarized-light) (defvar my-dark-theme 'doom-solarized-dark) (defun mac-appearance () (plist-get (mac-application-state) :appearance)) (defun dark-theme-enabled? () (string-equal (mac-appearance) "NSAppearanceNameDarkAqua")) (defun set-theme-from-system () (if (dark-theme-enabled?) (consult-theme my-dark-theme) (consult-theme my-light-theme))) (defvar theme-timer-status-cache (mac-appearance)) (defun theme-timer-fn () (let ((appearance (mac-appearance))) (when (not (string-equal appearance theme-timer-status-cache)) (set-theme-from-system) (setq theme-timer-status-cache appearance)))) (defun theme-timer-hook () (run-at-time "2 sec" 2 #'theme-timer-fn)) (add-hook 'after-init-hook #'theme-timer-hook) (provide 'init-mac)