From 6a92e688205d48e8f91eba97e305540321b444c6 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Mon, 3 Jan 2011 20:34:22 +0100 Subject: Add the `gnus-desktop-notify-safe' and improve defaults for most WMs. It turns out, most window managers and desktop environments don't support markup in the notification. Improve all defaults to avoid markup by default. --- gnus-desktop-notify.el | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'gnus-desktop-notify.el') 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: %d:%s" + (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 "
%d:%s" (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: %d:%s" - (cdr g) (gnus-desktop-notify-escape-html-entities (car g))))))))) + (shell-quote-argument text)))))) ;; Internals -- cgit v1.2.3