;; -*- lexical-binding: t; -*- (use-package @package@ :if (or (daemonp) window-system)) (let ((light-mode-theme '@light-mode-theme@) (dark-mode-theme '@dark-mode-theme@)) (mapc #'disable-theme custom-enabled-themes) (load-theme light-mode-theme :noconfirm :noenable) (load-theme dark-mode-theme :noconfirm :noenable) (defun my/modus-themes-custom (&rest _) (modus-themes-with-colors (custom-set-faces '(region ((t :extend nil))) `(git-gutter:added ((,c :foreground ,bg-added-fringe :background nil))) `(git-gutter:deleted ((,c :foreground ,bg-removed-fringe :background nil))) `(git-gutter:modified ((,c :foreground ,bg-changed-fringe :background nil))) `(git-gutter-fr:added ((,c :foreground ,bg-added-fringe :background nil))) `(git-gutter-fr:deleted ((,c :foreground ,bg-removed-fringe :background nil))) `(git-gutter-fr:modified ((,c :foreground ,bg-changed-fringe :background nil)))))) (add-hook 'modus-themes-after-load-theme-hook #'my/modus-themes-custom) (defun my/switch-theme-variant (mode) (interactive (list (intern (completing-read "Make it: " '("light" "dark") nil t)))) (cond ((eq mode 'dark) (disable-theme light-mode-theme) (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)))) (defun my/system-appearance () (if (and (eq system-type 'darwin) (string-equal "Dark" (string-trim-right (shell-command-to-string "defaults read -g AppleInterfaceStyle")))) 'dark 'light)) (defun my/match-theme-system-appearance () (interactive) (my/switch-theme-variant (my/system-appearance))) (my/switch-theme-variant (my/system-appearance)) (use-package kqueue :if (and (eq system-type 'darwin) window-system ) :config (progn (defun my/gp-notify-callback (event) (let* ((filename (elt event 2)) (basename (file-name-nondirectory filename))) (when (string-equal basename ".GlobalPreferences.plist") (my/match-theme-system-appearance)))) (setq my/kq-watcher-global-preferences (kqueue-add-watch (expand-file-name "~/Library/Preferences/") '(write) #'my/gp-notify-callback)))))