diff options
author | Alan Pearce | 2015-11-16 16:38:20 +0100 |
---|---|---|
committer | Alan Pearce | 2015-11-16 16:38:20 +0100 |
commit | f6c607e6a350eea8d5b7cfe20f9fe47317d03aee (patch) | |
tree | c98be8aefd283d08088c8ec9d64d6ac9b4ee921b /tag-emacs | |
parent | 818df9fc3af1a0f6deb903d262065256938e5676 (diff) | |
download | dotfiles-f6c607e6a350eea8d5b7cfe20f9fe47317d03aee.tar.lz dotfiles-f6c607e6a350eea8d5b7cfe20f9fe47317d03aee.tar.zst dotfiles-f6c607e6a350eea8d5b7cfe20f9fe47317d03aee.zip |
Emacs: Change themes based on sunlight
Diffstat (limited to 'tag-emacs')
-rw-r--r-- | tag-emacs/emacs.d/init.org | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index af96248..4dcbe05 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -237,7 +237,8 @@ lot of modes. #+BEGIN_SRC emacs-lisp (req-package solarized-theme :config (progn - (load-theme 'solarized-light t))) + (load-theme 'solarized-light t t) + (load-theme 'solarized-dark t t))) #+END_SRC Colourise colour names in certain types of buffer. I don’t use this @@ -837,6 +838,34 @@ Sometimes I want to insert a date or time into a buffer. (insert (format-time-string format)))) #+END_SRC +** Time of Day + +#+BEGIN_SRC emacs-lisp + (req-package rase + :config (progn + (defun switch-themes (sun-event &optional first-run) + "Switch themes on sunrise and sunset." + (if first-run ; set theme on initialization + (cond ((memq sun-event '(sunrise midday)) + (disable-theme 'solarized-dark) + (enable-theme 'solarized-light)) + ((memq sun-event '(sunset midnight)) + (disable-theme 'solarized-light) + (enable-theme 'solarized-dark))) + (cond ((eq sun-event 'sunrise) ; after initialization deal only + (disable-theme 'solarized-dark) ; with sunrise and sunset + (enable-theme 'solarized-light)) + ((eq sun-event 'sunset) + (disable-theme 'solarized-light) + (enable-theme 'solarized-dark))))) + + ;; sign this function to be invoked on sun events + (add-hook 'rase-functions 'switch-themes) + + ;; start the run-at-sun-event daemon, invoking hooks immediately + (rase-start t))) +#+END_SRC + * Directories Dired works quite nicely, but not always in the way I want. I don’t |