summaryrefslogtreecommitdiffhomepage
path: root/eos/jao-notify.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-01-11 20:57:56 +0000
committerjao <jao@gnu.org>2021-01-11 20:57:56 +0000
commit566935a0e14bf5538467fd8ec69788e558c96278 (patch)
treec7ca75e7d39e8e44c7b258c032ae7ad6ef3994d2 /eos/jao-notify.el
parentc9218804220c496d0c841eecaa0c8b6a92146880 (diff)
downloadelibs-566935a0e14bf5538467fd8ec69788e558c96278.tar.gz
elibs-566935a0e14bf5538467fd8ec69788e558c96278.tar.bz2
oops
Diffstat (limited to 'eos/jao-notify.el')
-rw-r--r--eos/jao-notify.el33
1 files changed, 33 insertions, 0 deletions
diff --git a/eos/jao-notify.el b/eos/jao-notify.el
new file mode 100644
index 0000000..dc48ca4
--- /dev/null
+++ b/eos/jao-notify.el
@@ -0,0 +1,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