Skip to content

Instantly share code, notes, and snippets.

@etscrivner
Created June 9, 2020 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etscrivner/36b337068927c2ed26e966dd90979a3a to your computer and use it in GitHub Desktop.
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.
;;
;; 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