diff options
| author | Michael Albinus | 2012-04-24 19:56:30 +0200 |
|---|---|---|
| committer | Michael Albinus | 2012-04-24 19:56:30 +0200 |
| commit | e43042fe33b3cf184e31219d4aef08a5a59815f9 (patch) | |
| tree | 6d28bd2d15a95cd9f023e57346b23928574aa115 | |
| parent | 1ec00a232a98f971c7b4c46f74636d14e48990a2 (diff) | |
| download | emacs-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.
| -rw-r--r-- | doc/lispref/ChangeLog | 3 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 43 | ||||
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/notifications.el | 74 |
4 files changed, 90 insertions, 38 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 3bb2abd7cfe..1c37e1600f4 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | 2012-04-24 Michael Albinus <michael.albinus@gmx.de> | 1 | 2012-04-24 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 2 | ||
| 3 | * os.texi: (Notifications): Add notifications-get-capabilities. | 3 | * os.texi (Notifications): Extend possible notification hints. |
| 4 | Add notifications-get-capabilities. | ||
| 4 | 5 | ||
| 5 | 2012-04-20 Chong Yidong <cyd@gnu.org> | 6 | 2012-04-20 Chong Yidong <cyd@gnu.org> |
| 6 | 7 | ||
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 424cddaff0a..d825a3f18c4 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -2271,7 +2271,7 @@ The notification title. | |||
| 2271 | @item :body @var{text} | 2271 | @item :body @var{text} |
| 2272 | The notification body text. Depending on the implementation of the | 2272 | The notification body text. Depending on the implementation of the |
| 2273 | notification server, the text could contain HTML markups, like | 2273 | notification server, the text could contain HTML markups, like |
| 2274 | @samp{"<b>bold text</b>"}, or hyperlinks. | 2274 | @samp{"<b>bold text</b>"}, hyperlinks, or images. |
| 2275 | 2275 | ||
| 2276 | @item :app-name @var{name} | 2276 | @item :app-name @var{name} |
| 2277 | The name of the application sending the notification. The default is | 2277 | The name of the application sending the notification. The default is |
| @@ -2301,6 +2301,10 @@ the notification never expires. Default value is -1. | |||
| 2301 | @item :urgency @var{urgency} | 2301 | @item :urgency @var{urgency} |
| 2302 | The urgency level. It can be @code{low}, @code{normal}, or @code{critical}. | 2302 | The urgency level. It can be @code{low}, @code{normal}, or @code{critical}. |
| 2303 | 2303 | ||
| 2304 | @item :action-items | ||
| 2305 | When this keyword is given, the @var{title} string of the actions is | ||
| 2306 | interpreted as icon name. | ||
| 2307 | |||
| 2304 | @item :category @var{category} | 2308 | @item :category @var{category} |
| 2305 | The type of notification this is, a string. | 2309 | The type of notification this is, a string. |
| 2306 | 2310 | ||
| @@ -2331,6 +2335,17 @@ example would be @samp{"message-new-instant"}. | |||
| 2331 | Causes the server to suppress playing any sounds, if it has that | 2335 | Causes the server to suppress playing any sounds, if it has that |
| 2332 | ability. | 2336 | ability. |
| 2333 | 2337 | ||
| 2338 | @item :resident | ||
| 2339 | When set the server will not automatically remove the notification | ||
| 2340 | when an action has been invoked. The notification will remain resident | ||
| 2341 | in the server until it is explicitly removed by the user or by the | ||
| 2342 | sender. This hint is likely only useful when the server has the | ||
| 2343 | @code{:persistence} capability. | ||
| 2344 | |||
| 2345 | @item :transient | ||
| 2346 | When set the server will treat the notification as transient and | ||
| 2347 | by-pass the server's persistence capability, if it should exist. | ||
| 2348 | |||
| 2334 | @item :x @var{position} | 2349 | @item :x @var{position} |
| 2335 | @itemx :y @var{position} | 2350 | @itemx :y @var{position} |
| 2336 | Specifies the X, Y location on the screen that the | 2351 | Specifies the X, Y location on the screen that the |
| @@ -2402,35 +2417,39 @@ This function closes a notification with identifier @var{id}. | |||
| 2402 | Returns the capabilities of the notification server, a list of strings. | 2417 | Returns the capabilities of the notification server, a list of strings. |
| 2403 | The following capabilities can be expected: | 2418 | The following capabilities can be expected: |
| 2404 | 2419 | ||
| 2405 | @table @asis | 2420 | @table @code |
| 2406 | @item "actions" | 2421 | @item :actions |
| 2407 | The server will provide the specified actions to the user. | 2422 | The server will provide the specified actions to the user. |
| 2408 | 2423 | ||
| 2409 | @item "body" | 2424 | @item :body |
| 2410 | Supports body text. | 2425 | Supports body text. |
| 2411 | 2426 | ||
| 2412 | @item "body-hyperlinks" | 2427 | @item :body-hyperlinks |
| 2413 | The server supports hyperlinks in the notifications. | 2428 | The server supports hyperlinks in the notifications. |
| 2414 | 2429 | ||
| 2415 | @item "body-images" | 2430 | @item :body-images |
| 2416 | The server supports images in the notifications. | 2431 | The server supports images in the notifications. |
| 2417 | 2432 | ||
| 2418 | @item "body-markup" | 2433 | @item :body-markup |
| 2419 | Supports markup in the body text. | 2434 | Supports markup in the body text. |
| 2420 | 2435 | ||
| 2421 | @item "icon-multi" | 2436 | @item :icon-multi |
| 2422 | The server will render an animation of all the frames in a given image | 2437 | The server will render an animation of all the frames in a given image |
| 2423 | array. | 2438 | array. |
| 2424 | 2439 | ||
| 2425 | @item "icon-static" | 2440 | @item :icon-static |
| 2426 | Supports display of exactly 1 frame of any given image array. This | 2441 | Supports display of exactly 1 frame of any given image array. This |
| 2427 | value is mutually exclusive with "icon-multi". | 2442 | value is mutually exclusive with @code{:icon-multi}. |
| 2443 | |||
| 2444 | @item :persistence | ||
| 2445 | The server supports persistence of notifications. | ||
| 2428 | 2446 | ||
| 2429 | @item "sound" | 2447 | @item :sound |
| 2430 | The server supports sounds on notifications. | 2448 | The server supports sounds on notifications. |
| 2431 | @end table | 2449 | @end table |
| 2432 | 2450 | ||
| 2433 | Further vendor-specific caps start with "x-vendor", like "x-gnome-foo-cap". | 2451 | Further vendor-specific caps start with @code{:x-vendor}, like |
| 2452 | @code{:x-gnome-foo-cap}. | ||
| 2434 | @end defun | 2453 | @end defun |
| 2435 | 2454 | ||
| 2436 | 2455 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0eda6b28936..13d401b8413 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -22,10 +22,14 @@ | |||
| 22 | 22 | ||
| 23 | 2012-04-24 Michael Albinus <michael.albinus@gmx.de> | 23 | 2012-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 | ||
| 31 | 2012-04-24 Leo Liu <sdl.web@gmail.com> | 35 | 2012-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. |
| 333 | The following capabilities can be expected: | 355 | The 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'. | |
| 348 | Further 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 | 373 | Further 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) |