diff options
author | jao <jao@gnu.org> | 2021-02-02 05:16:17 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-02-02 05:16:17 +0000 |
commit | 771abb84830678455de4625ac7f082d8100f0ea0 (patch) | |
tree | 0d303c2cb0861b949ca73a9705954f6a69c4f877 /lib/eos/jao-notify.el | |
parent | 81eceb5507aa0659e9f0c9761e54e9102085c4ac (diff) | |
download | elibs-771abb84830678455de4625ac7f082d8100f0ea0.tar.gz elibs-771abb84830678455de4625ac7f082d8100f0ea0.tar.bz2 |
libs -> lib/
Diffstat (limited to 'lib/eos/jao-notify.el')
-rw-r--r-- | lib/eos/jao-notify.el | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/eos/jao-notify.el b/lib/eos/jao-notify.el new file mode 100644 index 0000000..dc48ca4 --- /dev/null +++ b/lib/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 |