summaryrefslogtreecommitdiffhomepage
path: root/sys/jao-notify.el
blob: fdffe5e48c0e9b2c2fdbd9a63cf80abbfea4f348 (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
;; jao-notify.el -- Interacting with notification daemon

;; Copyright (c) 2017, 2019 Jose Antonio Ortega Ruiz

;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
;; Start date: Sun Jan 08, 2017 20:24


;;; Comentary:

;; Simple notifications using notify-send

;;; Code:

(defun jao-notify (msg &optional title icon)
  (let* ((title (shell-quote-argument title))
         (msg (shell-quote-argument msg))
         (args (if title (format "%s %s" msg title) msg))
         (iflag (if (and (stringp icon) (file-exists-p icon))
                   (format " -i %s" icon)
                 "")))
    (shell-command-to-string (format "notify-send %s%s" args iflag))))



(provide 'jao-notify)
;;; jao-notify.el ends here