From aba444b82b886a5883d63c111d108974dbf22879 Mon Sep 17 00:00:00 2001 From: Grégoire Duchêne Date: Sun, 4 Jul 2021 13:12:51 +0100 Subject: emacs: Parameterize theme selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, set the timer running ‘is-macos-dark’ (renamed to ‘macos-dark-p’) only when ‘after-init-hook’ is run. This makes it so that the correct themes will be used when ‘awhk-day-theme’ and ‘awhk-night-theme’ are changed in per-domain or per-host configuration. --- dotfiles-darwin/emacs/init.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'dotfiles-darwin/emacs') diff --git a/dotfiles-darwin/emacs/init.el b/dotfiles-darwin/emacs/init.el index c4b1e07..44bcda6 100644 --- a/dotfiles-darwin/emacs/init.el +++ b/dotfiles-darwin/emacs/init.el @@ -3,10 +3,12 @@ (when (executable-find "gls") (setq insert-directory-program "gls")) -(defun is-macos-dark () +(defun macos-dark-p () (interactive) (string= (shell-command-to-string "defaults read -g AppleInterfaceStyle") "Dark\n")) -(run-at-time nil (* 15 60) 'maybe-switch-theme 'doom-one-light 'doom-one - 'is-macos-dark) +(add-hook 'after-init-hook + (lambda () + (run-at-time nil (* 15 60) 'maybe-switch-theme awhk-day-theme + awhk-night-theme 'macos-dark-p))) -- cgit v1.2.3-70-g09d2