diff options
-rw-r--r-- | gnus-desktop-notify.el | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/gnus-desktop-notify.el b/gnus-desktop-notify.el index 78f4440..f52f900 100644 --- a/gnus-desktop-notify.el +++ b/gnus-desktop-notify.el @@ -54,6 +54,14 @@ ;; ;; See the `gnus-desktop-notify' customization group for more details. ;; +;; If you have KDE, or use Awesome (WM), you can use the following +;; configuration to improve the appearance of the notification (the icon path +;; is a standard Gnome stock icon): +;; +;; (setq +;; gnus-desktop-notify-send-program "notify-send -i /usr/share/icons/gnome/32x32/actions/mail_new.png" +;; gnus-desktop-notify-send-mode 'gnus-desktop-notify-multi) +;; ;; Feel free to send suggestions and patches to wavexx AT users.sf.net ;;; Code: @@ -111,18 +119,24 @@ function. Each argument will be of the form: :type 'file) (defcustom gnus-desktop-notify-send-program - "notify-send -i /usr/share/icons/gnome/32x32/actions/mail_new.png" + "notify-send -i /usr/share/icons/gnome/16x16/actions/mail_new.png" "Path and default arguments to the 'notify-send' program (part of libnotify's utilities)." :type 'file) -(defcustom gnus-desktop-notify-send-mode 'gnus-desktop-notify-multi +(defcustom gnus-desktop-notify-send-mode 'gnus-desktop-notify-safe "`gnus-desktop-notify-send' behavior. Can be either: +'gnus-desktop-notify-safe: display a single notification for + each group, without using markup. 'gnus-desktop-notify-single: display a single notification for - each group, + each group, using markup. 'gnus-desktop-notify-multi: display a multi-line notification for - all groups at once." + all groups at once, using markup. + + Markup is supported only on certain window managers/desktops, +such as KDE and Awesome. You can use '-single' or '-multi' on +those window managers." :type 'symbol) (defcustom gnus-desktop-notify-groups 'gnus-desktop-notify-all-except @@ -169,6 +183,17 @@ each argument being of the form 'number of new messages:mailbox name'." "Call 'notify-send' (as defined by `gnus-desktop-notify-send-program'), with the behavior defined by `gnus-desktop-notify-send-mode'." (case gnus-desktop-notify-send-mode + ('gnus-desktop-notify-safe + (dolist (g groups) + (call-process-shell-command gnus-desktop-notify-send-program nil 0 nil "--" + (shell-quote-argument + (format "New mail: %d:%s" (cdr g) (car g)))))) + ('gnus-desktop-notify-single + (dolist (g groups) + (call-process-shell-command gnus-desktop-notify-send-program nil 0 nil "--" + (shell-quote-argument + (format "New mail: <tt><b>%d</b>:<b>%s</b></tt>" + (cdr g) (gnus-desktop-notify-escape-html-entities (car g))))))) ('gnus-desktop-notify-multi (let ( (text "New mail:") ) (dolist (g groups) @@ -177,13 +202,7 @@ with the behavior defined by `gnus-desktop-notify-send-mode'." (format "<br/><tt> <b>%d</b>:<b>%s</b></tt>" (cdr g) (gnus-desktop-notify-escape-html-entities (car g)))))) (call-process-shell-command gnus-desktop-notify-send-program nil 0 nil "--" - (shell-quote-argument text)))) - ('gnus-desktop-notify-single - (dolist (g groups) - (call-process-shell-command gnus-desktop-notify-send-program nil 0 nil "--" - (shell-quote-argument - (format "New mail: <tt><b>%d</b>:<b>%s</b></tt>" - (cdr g) (gnus-desktop-notify-escape-html-entities (car g))))))))) + (shell-quote-argument text)))))) ;; Internals |