More
author |
Steve Losh <steve@stevelosh.com> |
date |
Thu, 28 Mar 2024 16:06:55 -0400 |
parents |
4673e928c08e |
children |
(none) |
(in-package :stumpwm-user)
(defparameter *pop-timer-minutes* nil)
(defparameter *pop-timer-seconds* nil)
(defun pop-timer ()
(if (or (null *pop-timer-minutes*)
(null *pop-timer-seconds*))
(message "Pop timer is not configured.")
(progn
(message "Setting pop timer for ~D:~2,'0D."
*pop-timer-minutes* *pop-timer-seconds*)
(let* ((warning-time 30)
(total-time (+ (* *pop-timer-minutes* 60) *pop-timer-seconds*))
(initial-time (- total-time warning-time)))
(sb-thread:make-thread
(lambda ()
(if (plusp initial-time)
(progn (sleep initial-time)
(speak "Pop soon.")
(sleep warning-time))
(sleep total-time))
(speak "Pop!"))
:name "Pop Timer")))))
(defcommand run-pop-timer () ()
(pop-timer))
(defcommand set-pop-timer (minutes seconds)
((:integer "Minutes: ")
(:integer "Seconds: "))
(setf *pop-timer-minutes* minutes
*pop-timer-seconds* seconds))
(defcommand tea-timer (seconds)
((:integer "Seconds: "))
(run-shell-command (format nil "tea ~D" seconds)))