aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaúl Benencia <id@rbenencia.name>2026-01-03 09:59:47 -0300
committerRaúl Benencia <id@rbenencia.name>2026-01-03 09:59:47 -0300
commit0844cbe4c39ba64d9c0e1f3e93534c09f957a3d7 (patch)
treeefd36347d4e54f5adc0388ecf76a57f749304edf
parent4cfa0013c045370738fda7aa8919ba789296ffbf (diff)
feat: replace notifications instead of stacking them
-rw-r--r--org-tempus.el22
1 files changed, 21 insertions, 1 deletions
diff --git a/org-tempus.el b/org-tempus.el
index bb27f14..89d7214 100644
--- a/org-tempus.el
+++ b/org-tempus.el
@@ -92,6 +92,16 @@ The value is a string like:
:type 'integer
:group 'org-tempus)
+(defcustom org-tempus-notification-timeout-ms 5000
+ "Milliseconds before notifications expire. Set to 0 to use defaults."
+ :type 'integer
+ :group 'org-tempus)
+
+(defcustom org-tempus-notification-replace t
+ "When non-nil, reuse a single notification instead of stacking them."
+ :type 'boolean
+ :group 'org-tempus)
+
(defcustom org-tempus-notification-max-count 3
"Maximum number of break or idle notifications."
:type 'integer
@@ -251,6 +261,9 @@ Known providers are `emacs' (activity inside Emacs),
(defvar org-tempus--notification-state nil
"Plist storing notification state for notifications.")
+(defvar org-tempus--notification-id nil
+ "Notification id used to replace existing notifications.")
+
(defun org-tempus--hide-org-mode-line ()
"Hide the stock Org mode line indicator while Org Tempus is active."
(when org-tempus-hide-org-mode-line-string
@@ -274,7 +287,14 @@ Known providers are `emacs' (activity inside Emacs),
(setq sent
(condition-case err
(progn
- (notifications-notify :title "Org Tempus" :body msg)
+ (setq org-tempus--notification-id
+ (notifications-notify
+ :title "Org Tempus"
+ :body msg
+ :timeout (when (> org-tempus-notification-timeout-ms 0)
+ org-tempus-notification-timeout-ms)
+ :replaces-id (when org-tempus-notification-replace
+ org-tempus--notification-id)))
t)
(error
(message "Org Tempus notification error: %s" err)
nihil fit ex nihilo