Created
June 9, 2020 02:53
-
-
Save etscrivner/36b337068927c2ed26e966dd90979a3a to your computer and use it in GitHub Desktop.
Tea steep timer. Blinks the modeline bar red when the tea is done steeping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; | |
;; Simple timer that will blink the mode-line bar. | |
;; | |
;; Example Usage: | |
;; | |
;; Set a timer for 5 secs from now: | |
;; | |
;; (blink-bar-after-timer "5 sec") | |
;; | |
;; Set a timer for when tea has steeped after 3 mins: | |
;; | |
;; (blink-bar-after-timer "3 min") | |
;; | |
(defun blink-bar (final-color first-color second-color count) | |
(if (< count 10) | |
(progn | |
(set-face-attribute 'mode-line nil :background second-color) | |
(run-at-time "1 sec" nil 'blink-bar final-color second-color first-color (+ count 1))) | |
(set-face-attribute 'mode-line nil :background final-color))) | |
(defun blink-bar-after-timer (time) | |
(let ((inactive-bg (face-attribute 'mode-line-inactive :background)) | |
(active-bg (face-attribute 'mode-line :background))) | |
(run-at-time time nil 'blink-bar active-bg "red" active-bg 0))) | |
(defun start-tea-timer () | |
(interactive) | |
(blink-bar-after-timer "3 min")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment