org-clock.el: New option `org-show-notification-timeout'

* lisp/org-clock.el (org-show-notification-timeout): New option.
(org-show-notification): Use `w32-notification-notify' and the new
option.
This commit is contained in:
Bastien 2020-01-26 17:35:18 +01:00
parent b6fc8396a6
commit f9c34a7d51
2 changed files with 21 additions and 0 deletions

View File

@ -42,6 +42,8 @@ using ~display-buffer~. This allows users to control how source
buffers are displayed by modifying ~display-buffer-alist~ or
~display-buffer-base-action~.
*** New option ~org-show-notification-timeout~
** New functions
*** ~org-columns-toggle-or-columns-quit~
=<C-c C-c>= bound to ~org-columns-toggle-or-columns-quit~ replaces the

View File

@ -273,6 +273,15 @@ also using the face `org-mode-line-clock-overrun'."
(const :tag "Just mark the time string" nil)
(string :tag "Text to prepend")))
(defcustom org-show-notification-timeout 3
"Number of seconds to wait before closing Org notifications.
This is applied to notifications send with `notifications-notify'
and `w32-notification-notify' only, not other mechanisms possibly
set throug `org-show-notification-handler'."
:group 'org-clock
:package-version '(Org . "9.4")
:type 'integer)
(defcustom org-show-notification-handler nil
"Function or program to send notification with.
The function or program will be called with the notification
@ -814,10 +823,20 @@ use libnotify if available, or fall back on a message."
((stringp org-show-notification-handler)
(start-process "emacs-timer-notification" nil
org-show-notification-handler notification))
((fboundp 'w32-notification-notify)
(let ((id (w32-notification-notify
:title "Org mode message"
:body notification
:urgency 'low)))
(run-with-timer
org-show-notification-timeout
nil
(lambda () (w32-notification-close id)))))
((fboundp 'notifications-notify)
(notifications-notify
:title "Org mode message"
:body notification
:timeout (* org-show-notification-timeout 1000)
;; FIXME how to link to the Org icon?
;; :app-icon "~/.emacs.d/icons/mail.png"
:urgency 'low))