summaryrefslogtreecommitdiff
path: root/lisp/notifications.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2012-04-24 19:56:30 +0200
committerMichael Albinus <michael.albinus@gmx.de>2012-04-24 19:56:30 +0200
commite43042fe33b3cf184e31219d4aef08a5a59815f9 (patch)
tree6d28bd2d15a95cd9f023e57346b23928574aa115 /lisp/notifications.el
parent1ec00a232a98f971c7b4c46f74636d14e48990a2 (diff)
downloademacs-e43042fe33b3cf184e31219d4aef08a5a59815f9.tar.gz
* 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/notifications.el')
-rw-r--r--lisp/notifications.el74
1 files changed, 51 insertions, 23 deletions
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 @@
;;; Commentary:
;; This package provides an implementation of the Desktop Notifications
-;; <http://www.galago-project.org/specs/notification/>.
+;; <http://developer.gnome.org/notification-spec/>.
;; In order to activate this package, you must add the following code
;; into your .emacs:
@@ -45,7 +45,7 @@
(require 'dbus)
-(defconst notifications-specification-version "1.1"
+(defconst notifications-specification-version "1.2"
"The version of the Desktop Notifications Specification implemented.")
(defconst notifications-application-name "Emacs"
@@ -157,6 +157,8 @@ Various PARAMS can be set:
Default value is -1.
:urgency The urgency level.
Either `low', `normal' or `critical'.
+ :action-items Whether the TITLE of the actions is interpreted as
+ a named icon.
:category The type of notification this is.
:desktop-entry This specifies the name of the desktop filename representing
the calling program.
@@ -173,6 +175,11 @@ Various PARAMS can be set:
be \"message-new-instant\".
:suppress-sound Causes the server to suppress playing any sounds, if it has
that ability.
+ :resident When set the server will not automatically remove the
+ notification when an action has been invoked.
+ :transient When set the server will treat the notification as transient
+ and by-pass the server's persistence capability, if it
+ should exist.
:x Specifies the X location on the screen that the notification
should point to. The \"y\" hint must also be specified.
:y Specifies the Y location on the screen that the notification
@@ -212,9 +219,12 @@ of another `notifications-notify' call."
(desktop-entry (plist-get params :desktop-entry))
(image-data (plist-get params :image-data))
(image-path (plist-get params :image-path))
+ (action-items (plist-get params :action-items))
(sound-file (plist-get params :sound-file))
(sound-name (plist-get params :sound-name))
(suppress-sound (plist-get params :suppress-sound))
+ (resident (plist-get params :resident))
+ (transient (plist-get params :transient))
(x (plist-get params :x))
(y (plist-get params :y))
id)
@@ -236,12 +246,16 @@ of another `notifications-notify' call."
(:variant :string ,desktop-entry)) t))
(when image-data
(add-to-list 'hints `(:dict-entry
- "image_data"
+ "image-data"
(:variant :struct ,image-data)) t))
(when image-path
(add-to-list 'hints `(:dict-entry
- "image_path"
+ "image-path"
(:variant :string ,image-path)) t))
+ (when action-items
+ (add-to-list 'hints `(:dict-entry
+ "action-items"
+ (:variant :boolean ,action-items)) t))
(when sound-file
(add-to-list 'hints `(:dict-entry
"sound-file"
@@ -254,6 +268,14 @@ of another `notifications-notify' call."
(add-to-list 'hints `(:dict-entry
"suppress-sound"
(:variant :boolean ,suppress-sound)) t))
+ (when resident
+ (add-to-list 'hints `(:dict-entry
+ "resident"
+ (:variant :boolean ,resident)) t))
+ (when transient
+ (add-to-list 'hints `(:dict-entry
+ "transient"
+ (:variant :boolean ,transient)) t))
(when x
(add-to-list 'hints `(:dict-entry "x" (:variant :int32 ,x)) t))
(when y
@@ -332,24 +354,30 @@ of another `notifications-notify' call."
"Return the capabilities of the notification server, a list of strings.
The following capabilities can be expected:
- \"actions\" The server will provide the specified actions
- to the user.
- \"body\" Supports body text.
- \"body-hyperlinks\" The server supports hyperlinks in the notifications.
- \"body-images\" The server supports images in the notifications.
- \"body-markup\" Supports markup in the body text.
- \"icon-multi\" The server will render an animation of all the
- frames in a given image array.
- \"icon-static\" Supports display of exactly 1 frame of any
- given image array. This value is mutually exclusive
- with \"icon-multi\".
- \"sound\" The server supports sounds on notifications.
-
-Further vendor-specific caps start with \"x-vendor\", like \"x-gnome-foo-cap\"."
- (dbus-call-method :session
- notifications-service
- notifications-path
- notifications-interface
- notifications-get-capabilities-method))
+ `:actions' The server will provide the specified actions
+ to the user.
+ `:action-icons' Supports using icons instead of text for
+ displaying actions.
+ `:body' Supports body text.
+ `:body-hyperlinks' The server supports hyperlinks in the notifications.
+ `:body-images' The server supports images in the notifications.
+ `:body-markup' Supports markup in the body text.
+ `:icon-multi' The server will render an animation of all the
+ frames in a given image array.
+ `:icon-static' Supports display of exactly 1 frame of any
+ given image array. This value is mutually exclusive
+ with `:icon-multi'.
+ `:persistence' The server supports persistence of notifications.
+ `:sound' The server supports sounds on notifications.
+
+Further vendor-specific caps start with `:x-vendor', like `:x-gnome-foo-cap'."
+ (dbus-ignore-errors
+ (mapcar
+ (lambda (x) (intern (concat ":" x)))
+ (dbus-call-method :session
+ notifications-service
+ notifications-path
+ notifications-interface
+ notifications-get-capabilities-method))))
(provide 'notifications)