Function: org-show-notification

org-show-notification is a byte-compiled function defined in org-clock.el.gz.

Signature

(org-show-notification NOTIFICATION)

Documentation

Show notification.

Use org-show-notification-handler if defined, use libnotify if available, or fall back on a message.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-clock.el.gz
(defun org-show-notification (notification)
  "Show notification.
Use `org-show-notification-handler' if defined,
use libnotify if available, or fall back on a message."
  (ignore-errors (require 'notifications))
  (cond ((functionp org-show-notification-handler)
	 (funcall org-show-notification-handler notification))
	((stringp org-show-notification-handler)
	 (start-process "emacs-timer-notification" nil
			org-show-notification-handler notification))
        ((fboundp 'haiku-notifications-notify)
         ;; N.B. timeouts are not available under Haiku.
         (haiku-notifications-notify :title "Org mode message"
                                     :body notification
                                     :urgency 'low))
        ((fboundp 'android-notifications-notify)
         ;; N.B. timeouts are not available under Haiku or Android.
         (android-notifications-notify :title "Org mode message"
                                       :body notification
                                       ;; Low urgency notifications
                                       ;; are by default hidden.
                                       :urgency 'normal))
	((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 'ns-do-applescript)
         (ns-do-applescript
          (format "display notification \"%s\" with title \"Org mode notification\""
                  (replace-regexp-in-string "\"" "#" notification))))
	((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))
	((executable-find "notify-send")
	 (start-process "emacs-timer-notification" nil
			"notify-send" notification))
	;; Maybe the handler will send a message, so only use message as
	;; a fall back option
	(t (message "%s" notification))))