aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus2012-04-24 19:56:30 +0200
committerMichael Albinus2012-04-24 19:56:30 +0200
commite43042fe33b3cf184e31219d4aef08a5a59815f9 (patch)
tree6d28bd2d15a95cd9f023e57346b23928574aa115 /lisp
parent1ec00a232a98f971c7b4c46f74636d14e48990a2 (diff)
downloademacs-e43042fe33b3cf184e31219d4aef08a5a59815f9.tar.gz
emacs-e43042fe33b3cf184e31219d4aef08a5a59815f9.zip
* notifications.el (notifications-specification-version): Change to "1.2".
(notifications-notify): Add :action-items, :resident and :transient hints. Change "image_data" to "image-data" and "image_path" to "image-path". (notifications-get-capabilities): Return a list of keywords. * os.texi (Notifications): Extend possible notification hints.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/notifications.el74
2 files changed, 57 insertions, 25 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0eda6b28936..13d401b8413 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -22,10 +22,14 @@
22 22
232012-04-24 Michael Albinus <michael.albinus@gmx.de> 232012-04-24 Michael Albinus <michael.albinus@gmx.de>
24 24
25 * notifications.el (notifications-interface) 25 * notifications.el (notifications-specification-version): Change
26 (notifications-notify-method, notifications-notify) 26 to "1.2".
27 (notifications-interface, notifications-notify-method)
27 (notifications-close-notification-method): Fix docstring. 28 (notifications-close-notification-method): Fix docstring.
28 (notifications-get-capabilities-method): New defconst. 29 (notifications-get-capabilities-method): New defconst.
30 (notifications-notify): Add :action-items, :resident and
31 :transient hints. Change "image_data" to "image-data" and
32 "image_path" to "image-path".
29 (notifications-get-capabilities): New defun. 33 (notifications-get-capabilities): New defun.
30 34
312012-04-24 Leo Liu <sdl.web@gmail.com> 352012-04-24 Leo Liu <sdl.web@gmail.com>
diff --git a/lisp/notifications.el b/lisp/notifications.el
index 9dad2a91b93..1b24f530c6d 100644
--- a/lisp/notifications.el
+++ b/lisp/notifications.el
@@ -23,7 +23,7 @@
23;;; Commentary: 23;;; Commentary:
24 24
25;; This package provides an implementation of the Desktop Notifications 25;; This package provides an implementation of the Desktop Notifications
26;; <http://www.galago-project.org/specs/notification/>. 26;; <http://developer.gnome.org/notification-spec/>.
27 27
28;; In order to activate this package, you must add the following code 28;; In order to activate this package, you must add the following code
29;; into your .emacs: 29;; into your .emacs:
@@ -45,7 +45,7 @@
45 45
46(require 'dbus) 46(require 'dbus)
47 47
48(defconst notifications-specification-version "1.1" 48(defconst notifications-specification-version "1.2"
49 "The version of the Desktop Notifications Specification implemented.") 49 "The version of the Desktop Notifications Specification implemented.")
50 50
51(defconst notifications-application-name "Emacs" 51(defconst notifications-application-name "Emacs"
@@ -157,6 +157,8 @@ Various PARAMS can be set:
157 Default value is -1. 157 Default value is -1.
158 :urgency The urgency level. 158 :urgency The urgency level.
159 Either `low', `normal' or `critical'. 159 Either `low', `normal' or `critical'.
160 :action-items Whether the TITLE of the actions is interpreted as
161 a named icon.
160 :category The type of notification this is. 162 :category The type of notification this is.
161 :desktop-entry This specifies the name of the desktop filename representing 163 :desktop-entry This specifies the name of the desktop filename representing
162 the calling program. 164 the calling program.
@@ -173,6 +175,11 @@ Various PARAMS can be set:
173 be \"message-new-instant\". 175 be \"message-new-instant\".
174 :suppress-sound Causes the server to suppress playing any sounds, if it has 176 :suppress-sound Causes the server to suppress playing any sounds, if it has
175 that ability. 177 that ability.
178 :resident When set the server will not automatically remove the
179 notification when an action has been invoked.
180 :transient When set the server will treat the notification as transient
181 and by-pass the server's persistence capability, if it
182 should exist.
176 :x Specifies the X location on the screen that the notification 183 :x Specifies the X location on the screen that the notification
177 should point to. The \"y\" hint must also be specified. 184 should point to. The \"y\" hint must also be specified.
178 :y Specifies the Y location on the screen that the notification 185 :y Specifies the Y location on the screen that the notification
@@ -212,9 +219,12 @@ of another `notifications-notify' call."
212 (desktop-entry (plist-get params :desktop-entry)) 219 (desktop-entry (plist-get params :desktop-entry))
213 (image-data (plist-get params :image-data)) 220 (image-data (plist-get params :image-data))
214 (image-path (plist-get params :image-path)) 221 (image-path (plist-get params :image-path))
222 (action-items (plist-get params :action-items))
215 (sound-file (plist-get params :sound-file)) 223 (sound-file (plist-get params :sound-file))
216 (sound-name (plist-get params :sound-name)) 224 (sound-name (plist-get params :sound-name))
217 (suppress-sound (plist-get params :suppress-sound)) 225 (suppress-sound (plist-get params :suppress-sound))
226 (resident (plist-get params :resident))
227 (transient (plist-get params :transient))
218 (x (plist-get params :x)) 228 (x (plist-get params :x))
219 (y (plist-get params :y)) 229 (y (plist-get params :y))
220 id) 230 id)
@@ -236,12 +246,16 @@ of another `notifications-notify' call."
236 (:variant :string ,desktop-entry)) t)) 246 (:variant :string ,desktop-entry)) t))
237 (when image-data 247 (when image-data
238 (add-to-list 'hints `(:dict-entry 248 (add-to-list 'hints `(:dict-entry
239 "image_data" 249 "image-data"
240 (:variant :struct ,image-data)) t)) 250 (:variant :struct ,image-data)) t))
241 (when image-path 251 (when image-path
242 (add-to-list 'hints `(:dict-entry 252 (add-to-list 'hints `(:dict-entry
243 "image_path" 253 "image-path"
244 (:variant :string ,image-path)) t)) 254 (:variant :string ,image-path)) t))
255 (when action-items
256 (add-to-list 'hints `(:dict-entry
257 "action-items"
258 (:variant :boolean ,action-items)) t))
245 (when sound-file 259 (when sound-file
246 (add-to-list 'hints `(:dict-entry 260 (add-to-list 'hints `(:dict-entry
247 "sound-file" 261 "sound-file"
@@ -254,6 +268,14 @@ of another `notifications-notify' call."
254 (add-to-list 'hints `(:dict-entry 268 (add-to-list 'hints `(:dict-entry
255 "suppress-sound" 269 "suppress-sound"
256 (:variant :boolean ,suppress-sound)) t)) 270 (:variant :boolean ,suppress-sound)) t))
271 (when resident
272 (add-to-list 'hints `(:dict-entry
273 "resident"
274 (:variant :boolean ,resident)) t))
275 (when transient
276 (add-to-list 'hints `(:dict-entry
277 "transient"
278 (:variant :boolean ,transient)) t))
257 (when x 279 (when x
258 (add-to-list 'hints `(:dict-entry "x" (:variant :int32 ,x)) t)) 280 (add-to-list 'hints `(:dict-entry "x" (:variant :int32 ,x)) t))
259 (when y 281 (when y
@@ -332,24 +354,30 @@ of another `notifications-notify' call."
332 "Return the capabilities of the notification server, a list of strings. 354 "Return the capabilities of the notification server, a list of strings.
333The following capabilities can be expected: 355The following capabilities can be expected:
334 356
335 \"actions\" The server will provide the specified actions 357 `:actions' The server will provide the specified actions
336 to the user. 358 to the user.
337 \"body\" Supports body text. 359 `:action-icons' Supports using icons instead of text for
338 \"body-hyperlinks\" The server supports hyperlinks in the notifications. 360 displaying actions.
339 \"body-images\" The server supports images in the notifications. 361 `:body' Supports body text.
340 \"body-markup\" Supports markup in the body text. 362 `:body-hyperlinks' The server supports hyperlinks in the notifications.
341 \"icon-multi\" The server will render an animation of all the 363 `:body-images' The server supports images in the notifications.
342 frames in a given image array. 364 `:body-markup' Supports markup in the body text.
343 \"icon-static\" Supports display of exactly 1 frame of any 365 `:icon-multi' The server will render an animation of all the
344 given image array. This value is mutually exclusive 366 frames in a given image array.
345 with \"icon-multi\". 367 `:icon-static' Supports display of exactly 1 frame of any
346 \"sound\" The server supports sounds on notifications. 368 given image array. This value is mutually exclusive
347 369 with `:icon-multi'.
348Further vendor-specific caps start with \"x-vendor\", like \"x-gnome-foo-cap\"." 370 `:persistence' The server supports persistence of notifications.
349 (dbus-call-method :session 371 `:sound' The server supports sounds on notifications.
350 notifications-service 372
351 notifications-path 373Further vendor-specific caps start with `:x-vendor', like `:x-gnome-foo-cap'."
352 notifications-interface 374 (dbus-ignore-errors
353 notifications-get-capabilities-method)) 375 (mapcar
376 (lambda (x) (intern (concat ":" x)))
377 (dbus-call-method :session
378 notifications-service
379 notifications-path
380 notifications-interface
381 notifications-get-capabilities-method))))
354 382
355(provide 'notifications) 383(provide 'notifications)