aboutsummaryrefslogtreecommitdiff
path: root/modules/home-manager/emacs/config/lisp/timer.el
diff options
context:
space:
mode:
authorDylan <boss@tehbox.org>2026-10-22 13:02:16 +1300
committerDylan <boss@tehbox.org>2026-10-22 17:19:36 +1300
commitcc47c443a3f86aa66d2719ee57c0e6e728ee655e (patch)
tree6e57c4e13cf07486d4a02a3652bf84a9889f97a6 /modules/home-manager/emacs/config/lisp/timer.el
parent008b591a0a5942ae42f4c07a5abbee4dbd2d0743 (diff)
downloadnixos-configuration-cc47c443a3f86aa66d2719ee57c0e6e728ee655e.tar.gz
nixos-configuration-cc47c443a3f86aa66d2719ee57c0e6e728ee655e.zip
feat: Included the emacs configdendritic
Some packages are built with nix and some are still built with emacs
Diffstat (limited to 'modules/home-manager/emacs/config/lisp/timer.el')
-rw-r--r--modules/home-manager/emacs/config/lisp/timer.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/home-manager/emacs/config/lisp/timer.el b/modules/home-manager/emacs/config/lisp/timer.el
new file mode 100644
index 0000000..359fe28
--- /dev/null
+++ b/modules/home-manager/emacs/config/lisp/timer.el
@@ -0,0 +1,25 @@
+;;; timer.el - Sends you a notification after a certain time
+
+(defun timer-do-alert (title body)
+ "Uses `message' and `notifications-notify' to send an alert"
+ (message (format "%s - %s" title body))
+ (notifications-notify :title title :body body))
+
+(defun timer-alert (delay body)
+ "Sends an alert after DELAY containing the message BODY."
+ (interactive "sDelay: \nsBody: ")
+ (let (seconds minutes hours num-string)
+ (dolist (char (delete "" (split-string "3s" "")))
+ (if (seq-contains-p (delete "" (split-string "0123456789" "")) char)
+ (setq num-string (concat num-string char))
+ (progn (cond ((equal char "s") (setq seconds (string-to-number num-string)))
+ ((equal char "m") (setq minutes (string-to-number num-string)))
+ ((equal char "h") (setq hours (string-to-number num-string))))
+ (setq num-string ""))))
+ (unless seconds
+ (setq seconds 0))
+ (unless minutes
+ (setq minutes 0))
+ (unless hours
+ (setq hours 0))
+ (run-at-time (format "%s sec %s min %s hour" seconds minutes hours) nil 'timer-do-alert "Emacs alert" body)))