;; -*- lexical-binding: t; -*- (defcustom my-light-theme 'doom-solarized-light "My light theme." :type 'symbol :group 'personal :options (custom-available-themes)) (defcustom my-dark-theme 'doom-solarized-dark "My dark theme." :type 'symbol :group 'personal :options (custom-available-themes)) (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) (unbind-key "C-" global-map) (unbind-key "C-S-" global-map) (provide 'init-mac)