branch: externals/tmr
commit 2ecee44804cfc4fd1347fcca0679504e7f6d08c0
Author: Christian Tietze <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Define tmr-notify-function and tmr-notifications-notify implementation
Signed-off-by: Christian Tietze <[email protected]>
---
tmr.el | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tmr.el b/tmr.el
index f1683a571f..010d12b580 100644
--- a/tmr.el
+++ b/tmr.el
@@ -97,6 +97,12 @@ such notifications."
:type '(repeat string)
:group 'tmr)
+(defcustom tmr-notify-function #'tmr-notifications-notify
+ "Function called to send notification.
+It should take two string arguments: the title and the message."
+ :type 'function
+ :group 'tmr)
+
(defun tmr--unit (time)
"Determine common time unit for TIME."
(cond
@@ -152,6 +158,17 @@ such notifications."
win))
(user-error "No *tmr-messages* buffer; have you used `tmr'?")))
+(defun tmr-notifications-notify (title message)
+ "Dispatch notification titled TITLE with MESSAGE via D-Bus.
+
+Read: (info \"(elisp) Desktop Notifications\") for details."
+ (notifications-notify
+ :title title
+ :body message
+ :app-name "GNU Emacs"
+ :urgency tmr-notification-urgency
+ :sound-file tmr-sound-file))
+
(defun tmr--notify-send (start &optional description)
"Send system notification for timer with START time.
Optionally include DESCRIPTION."