Skip to content

Instantly share code, notes, and snippets.

@ralt
Created August 18, 2015 13:03
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 ralt/a1c41a4a56399897a63c to your computer and use it in GitHub Desktop.
Save ralt/a1c41a4a56399897a63c to your computer and use it in GitHub Desktop.
stumpwm alert-me-at
(ql:quickload :bordeaux-threads)
(defcommand alert-me-at (alert-hour alert-minute message) ((:number "hour: ") (:number "minute: ") (:string "message: "))
"Alert me at some point in time. Doesn't handle time too early, so the thread will go on forever."
(bordeaux-threads:make-thread
#'(lambda ()
(loop
do (sleep 5)
when (multiple-value-bind (seconds minute hour)
(get-decoded-time)
(declare (ignore seconds))
(and (= alert-hour hour) (= alert-minute minute)))
do (progn
(stumpwm:message "The timer for ~A is now! (1/3 remainder)" message)
(sleep 10)
(stumpwm:message "The timer for ~A is now! (2/3 remainder)" message)
(sleep 10)
(stumpwm:message "The timer for ~A is now! (3/3 remainder)" message)
(return))))
:name (format nil "Alert thread: ~A" message)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment