blob: dc48ca4d5db888f57ec73c660938a53595fe2eda (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
;; jao-notify.el -- Interacting with notification daemon
;; Copyright (c) 2017, 2019, 2020 Jose Antonio Ortega Ruiz
;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
;; Start date: Sun Jan 08, 2017 20:24
;;; Comentary:
;; Simple notifications using echo or dbus notifications
;;; Code:
(defvar jao-notify-use-messages-p nil)
(defvar jao-notify-timeout 5000)
(declare-function notifications-notify "notifications")
(defun jao-notify (msg &optional title icon)
(if jao-notify-use-messages-p
(message "%s%s%s" (or title "") (if title ": " "") (or msg ""))
(let* ((args `(:timeout ,jao-notify-timeout))
(args (append args
(if title `(:title ,title :body ,msg) `(:title ,msg))))
(args (if (and (stringp icon) (file-exists-p icon))
(append args `(:app-icon ,(format "%s" icon)))
args)))
(apply 'notifications-notify args))))
(provide 'jao-notify)
;;; jao-notify.el ends here
|