2004-06-30 08:01:57 -05:00
|
|
|
FreeDesktop proposed notifications spec
|
|
|
|
=======================================
|
|
|
|
|
|
|
|
(c) 2004 Mike Hearn <mike@navi.cx>
|
|
|
|
2004 Christian Hammond <chipx86@chipx86.com>
|
|
|
|
|
|
|
|
ChangeLog:
|
|
|
|
|
|
|
|
v0.1:
|
|
|
|
* Initial version
|
2004-07-06 16:18:00 -05:00
|
|
|
v0.2:
|
|
|
|
* Add replaces field to protocol
|
2004-08-11 04:27:00 -05:00
|
|
|
|
2004-06-30 08:01:57 -05:00
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
OVERVIEW
|
|
|
|
|
|
|
|
This is a draft standard for a desktop notifications service, through
|
|
|
|
which applications can generate passive popups (sometimes known as
|
|
|
|
"poptarts") to notify the user in an asynchronous manner of events.
|
|
|
|
|
|
|
|
This specification explicitly does not include other types of
|
|
|
|
notification presentation such as modal message boxes, window manager
|
|
|
|
decorations or window list annotations.
|
|
|
|
|
|
|
|
Example use cases include:
|
|
|
|
|
|
|
|
* Presence changes in IM programs: for instance, MSN Messenger on
|
|
|
|
Windows pioneered the use of passive popups to indicate presence
|
|
|
|
changes.
|
2004-06-30 13:58:41 -05:00
|
|
|
|
2004-06-30 08:01:57 -05:00
|
|
|
* New mail notification
|
|
|
|
|
|
|
|
* Low disk space/battery warnings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BASIC DESIGN
|
|
|
|
|
|
|
|
In order to ensure that multiple notifications can easily be
|
|
|
|
displayed at once, and to provide a convenient implementation, all
|
|
|
|
notifications are controlled by a single session-scoped service which
|
|
|
|
exposes a DBUS interface.
|
|
|
|
|
|
|
|
On startup, a conforming implementation should take the
|
|
|
|
"org.freedesktop.Notifications" service on the session bus. This
|
|
|
|
service will be referred to as the "notification server" or just "the
|
|
|
|
server" in this document. It can optionally be activated automatically
|
|
|
|
by the bus process, however this is not required and notification
|
|
|
|
server clients must not assume that it is available.
|
|
|
|
|
|
|
|
The server should implement the "org.freedesktop.Notifications" interface on
|
2004-06-30 13:58:41 -05:00
|
|
|
an object with the path "/org/freedesktop/Notifications". This is the
|
2004-06-30 08:01:57 -05:00
|
|
|
only interface required by this version of the specification.
|
|
|
|
|
|
|
|
A notification has the following components:
|
|
|
|
|
2004-08-11 04:27:00 -05:00
|
|
|
- Application name: This is the optional name of the application sending
|
|
|
|
the notification. This should be the application's formal name, rather
|
|
|
|
than some sort of ID.
|
|
|
|
|
|
|
|
- Application icon: An optional byte array containing the application's icon.
|
|
|
|
This should be in PNG or GIF formats.
|
|
|
|
|
|
|
|
- Replaces ID: An optional ID of an existing notification that this
|
|
|
|
notification is intended to replace.
|
|
|
|
|
|
|
|
- Notification Type ID: An optional ID representing the notification type.
|
|
|
|
See the NOTIFICATION TYPES section below.
|
|
|
|
|
|
|
|
- Urgency level: The urgency of the notification. See the URGENCY LEVELS
|
|
|
|
section below.
|
|
|
|
|
2004-06-30 08:01:57 -05:00
|
|
|
- A summary: This is a single line overview of the notification. For
|
2004-07-06 16:18:00 -05:00
|
|
|
instance "You have mail" or "A friend has come online". Tip: It
|
|
|
|
should generally not be longer than 40 characters though this is not
|
|
|
|
a requirement and server implementations should word wrap if
|
|
|
|
necessary. The summary must be encoded using UTF-8.
|
2004-06-30 08:01:57 -05:00
|
|
|
|
|
|
|
- An optional body: This is a multi-line body of text. Each line is a
|
|
|
|
paragraph, server implementations are free to word wrap them as they
|
|
|
|
see fit.
|
|
|
|
|
|
|
|
The text may contain simple markup as specified in the MARKUP
|
2004-07-01 16:53:48 -05:00
|
|
|
section below. It must be encoded using UTF-8.
|
2004-06-30 08:01:57 -05:00
|
|
|
|
|
|
|
If the body is omitted just the summary is displayed.
|
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
- An optional array of images: See the ICONS/SOUNDS section below.
|
2004-06-30 08:01:57 -05:00
|
|
|
|
|
|
|
- An optional sound: See the ICONS/SOUNDS section below.
|
|
|
|
|
2004-08-11 04:27:00 -05:00
|
|
|
- An dictionary of actions. The actions send a request message back to the
|
2004-07-01 18:01:36 -05:00
|
|
|
notification client when invoked. This functionality may not be
|
2004-07-01 16:53:48 -05:00
|
|
|
implemented by the notification server, conforming clients should
|
2004-07-01 18:03:12 -05:00
|
|
|
check if it is available before using it (see the GetCapabilities message
|
2004-07-01 16:53:48 -05:00
|
|
|
in the PROTOCOL section). An implementation is free to ignore any
|
2004-07-01 18:01:36 -05:00
|
|
|
requested by the client. As an example one possible rendering of
|
|
|
|
actions would be as buttons in the notification popup.
|
2004-06-30 08:01:57 -05:00
|
|
|
|
2004-08-11 04:27:00 -05:00
|
|
|
- An optional dictionary of hints: See the HINTS section below.
|
|
|
|
|
2004-07-04 16:09:58 -05:00
|
|
|
- An expiration time: the timestamp in seconds since the epoch that the
|
|
|
|
notification should close. If one wishes to have an expiration of 5 seconds
|
|
|
|
from now, they must grab the current timestamp and add 5 seconds to it.
|
2004-06-30 08:01:57 -05:00
|
|
|
|
2004-07-06 16:18:00 -05:00
|
|
|
If zero, the notification's expiration time is dependent on the
|
|
|
|
notification server's settings, and may vary for the type of
|
2004-08-11 04:27:00 -05:00
|
|
|
notification.
|
2004-07-04 16:09:58 -05:00
|
|
|
|
|
|
|
The expiration time should be respected by implementations, but this is
|
|
|
|
not required (this is for compatibility with KNotify).
|
2004-06-30 13:58:41 -05:00
|
|
|
|
2004-07-06 15:48:50 -05:00
|
|
|
Each notification displayed is allocated a unique ID by the server.
|
|
|
|
This is unique within the session - while the notification server is
|
|
|
|
running the ID will not be recycled unless the capacity of a uint32 is
|
|
|
|
exceeded.
|
|
|
|
|
|
|
|
This can be used to hide the notification before the expiration time
|
|
|
|
is reached. It can also be used to atomically replace the notification
|
|
|
|
with another: this allows you to (for instance) modify the contents of
|
|
|
|
a notification while it's on-screen.
|
2004-06-30 08:01:57 -05:00
|
|
|
|
|
|
|
|
|
|
|
BACKWARDS COMPATIBILITY
|
|
|
|
|
2004-08-11 04:27:00 -05:00
|
|
|
Clients should try and avoid making assumptions about the presentation and
|
|
|
|
abilities of the notification server. The message content is the most
|
|
|
|
important thing.
|
2004-06-30 08:01:57 -05:00
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
Clients can check with the server what capabilities are supported
|
2004-07-01 18:03:12 -05:00
|
|
|
using the GetCapabilities message. See the PROTOCOL section.
|
2004-07-01 16:53:48 -05:00
|
|
|
|
|
|
|
If a client requires a response from a passive popup, it should be
|
|
|
|
coded such that a non-focus-stealing message box can be used instead
|
|
|
|
and the notification server is only used when available.
|
|
|
|
|
2004-06-30 08:01:57 -05:00
|
|
|
|
|
|
|
MARKUP
|
|
|
|
|
2004-07-01 02:59:41 -05:00
|
|
|
Description text may contain markup. The markup is XML-based, and consists
|
|
|
|
of a small subset of HTML along with a few additional tags.
|
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
The following tags can optionally be supported:
|
2004-06-30 08:01:57 -05:00
|
|
|
|
2004-07-01 02:59:41 -05:00
|
|
|
- <b>...</b> - Bold
|
|
|
|
- <i>...</i> - Italic
|
|
|
|
- <u>...</u> - Underline
|
|
|
|
- <a href="...">...</a> - Hyperlink
|
|
|
|
|
2004-08-11 04:27:00 -05:00
|
|
|
TODO: What else do we want here?
|
|
|
|
|
2004-06-30 08:01:57 -05:00
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
ICONS/SOUNDS
|
2004-07-01 02:59:41 -05:00
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
A notification can optionally include an array of images and/or a
|
|
|
|
single sound. The array of images specifies frames in an animation,
|
|
|
|
animations always loop. Implementations are free to ignore the
|
|
|
|
image/sound data, and implementations that support images may not
|
|
|
|
support animation.
|
2004-07-01 02:59:41 -05:00
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
If the image array has more than one element, a "primary frame" can
|
|
|
|
be specified - if not specified it defaults to the first frame. For
|
|
|
|
implementations that support images but not animation (for instance a
|
|
|
|
KNotify bridge), only the primary frame will be used.
|
2004-07-01 02:59:41 -05:00
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
Each element of the array must have the same type as the first
|
|
|
|
element, mixtures of strings and blobs are not allowed. The element
|
|
|
|
types can be one of the following:
|
2004-07-01 02:59:41 -05:00
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
* [string] Icon theme name. Any string that does not begin with the /
|
|
|
|
character is assumed to be an icon theme name and is looked up
|
|
|
|
according to the spec. The best size to fit the servers chosen
|
|
|
|
presentation will be used. This is the recommended way of
|
|
|
|
specifying images.
|
2004-06-30 08:01:57 -05:00
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
* [string] Absolute path. Any string that begins with a / will be
|
|
|
|
used as an absolute file path. Implementations should support at
|
|
|
|
minimum files of type image/png and image/svg.
|
2004-07-01 02:59:41 -05:00
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
* [binary] A data stream may be embedded in the message. This is
|
|
|
|
assumed to be of type image/png.
|
2004-07-01 02:59:41 -05:00
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
A sound can be specified, this will be played by the notification
|
2004-07-01 17:44:17 -05:00
|
|
|
server when the notification is displayed. FIXME: elaborate here.
|
2004-07-01 02:59:41 -05:00
|
|
|
|
2004-08-11 04:27:00 -05:00
|
|
|
|
|
|
|
NOTIFICATION TYPES:
|
|
|
|
|
|
|
|
Write me.
|
|
|
|
|
|
|
|
|
|
|
|
URGENCY LEVELS:
|
|
|
|
|
|
|
|
Write me.
|
|
|
|
|
|
|
|
|
|
|
|
HINTS:
|
|
|
|
|
|
|
|
Write me.
|
|
|
|
|
|
|
|
|
2004-07-01 16:53:48 -05:00
|
|
|
PROTOCOL
|
2004-06-30 08:01:57 -05:00
|
|
|
|
2004-07-01 17:44:17 -05:00
|
|
|
The following messages must be supported by all implementations.
|
|
|
|
|
2004-07-01 18:03:12 -05:00
|
|
|
* GetCapabilities
|
2004-07-01 17:44:17 -05:00
|
|
|
|
|
|
|
This message takes no parameters.
|
2004-07-01 18:01:36 -05:00
|
|
|
|
2004-07-01 17:44:17 -05:00
|
|
|
It returns an array of strings. Each string describes an optional
|
|
|
|
capability implemented by the server. The following values are
|
|
|
|
defined by this spec:
|
|
|
|
|
|
|
|
"body": Supports body text. Some implementations may only show the
|
|
|
|
summary (for instance, onscreen displays, marquee/scrollers)
|
2004-07-01 18:01:36 -05:00
|
|
|
|
2004-07-13 18:00:33 -05:00
|
|
|
"markup": Supports markup in the body text. If marked up text is sent
|
|
|
|
to a server that does not give this cap, the markup will show
|
|
|
|
through as regular text so must be stripped clientside.
|
2004-07-01 18:01:36 -05:00
|
|
|
|
2004-07-01 17:44:17 -05:00
|
|
|
"static-image" : Supports display of exactly 1 frame of any given
|
|
|
|
image array. This value is mutually exclusive with
|
|
|
|
"multi-image", it is a protocol error for the
|
2004-07-13 18:00:33 -05:00
|
|
|
server to specify both.
|
2004-08-11 04:27:00 -05:00
|
|
|
|
2004-07-01 17:44:17 -05:00
|
|
|
"multi-image": The server will render an animation of all the frames
|
2004-07-13 18:00:33 -05:00
|
|
|
in a given image array. The client may still specify
|
|
|
|
multiple frames even if this cap and/or static-image
|
|
|
|
is missing, however the server is free to ignore them
|
|
|
|
and use only the primary frame.
|
2004-07-01 17:44:17 -05:00
|
|
|
|
|
|
|
"sound": The server will play the specified sound. Even if this cap
|
|
|
|
is missing, a sound may still be specified however the
|
|
|
|
server is free to ignore it.
|
|
|
|
|
|
|
|
"actions": The server will provide the specified actions to the
|
|
|
|
user. Even if this cap is missing, actions may still be
|
|
|
|
specified by the client, however the server is free to
|
|
|
|
ignore them.
|
|
|
|
|
|
|
|
New vendor-specific caps may be specified as long as they start with
|
|
|
|
"x-vendorname", so for instance "x-gnome-foo-cap". Caps may not
|
|
|
|
contain spaces in their names (FIXME: this feels right but is it
|
|
|
|
really necessary?)
|
2004-07-01 18:01:36 -05:00
|
|
|
|
|
|
|
* Notify
|
|
|
|
|
|
|
|
This message requires the following parameters in the exact order
|
|
|
|
shown. For some parameters multiple types may be acceptable
|
|
|
|
|
2004-08-11 04:27:00 -05:00
|
|
|
STRING/NIL application name: the name of the application sending the
|
|
|
|
notification.
|
|
|
|
|
|
|
|
BYTE ARRAY/NIL application icon: the optional icon for the calling
|
|
|
|
application.
|
|
|
|
|
2004-07-13 18:00:33 -05:00
|
|
|
UINT32 replaces: if non-zero this is the notification ID that
|
|
|
|
this notification replaces. The server must atomically (ie with
|
|
|
|
no flicker or other visual cues) replace the given notification
|
|
|
|
with this one. This allows clients to effectively modify the
|
|
|
|
notification while it's active.
|
2004-08-11 04:27:00 -05:00
|
|
|
|
|
|
|
STRING/NIL notification type: the type ID of the notification, for
|
|
|
|
potential server categorization and logging purposes. See the
|
|
|
|
NOTIFICATION TYPES section.
|
|
|
|
|
2004-07-04 15:34:32 -05:00
|
|
|
BYTE urgency: The urgency level:
|
2004-08-11 04:27:00 -05:00
|
|
|
0 - low urgency
|
|
|
|
1 - medium
|
|
|
|
2 - high
|
|
|
|
3 - critical
|
|
|
|
|
|
|
|
See the URGENCY LEVELS section for more information.
|
2004-07-04 15:34:32 -05:00
|
|
|
|
2004-07-06 16:18:00 -05:00
|
|
|
Other values should be treated as "medium" in this version of the spec.
|
|
|
|
|
2004-07-01 18:01:36 -05:00
|
|
|
STRING summary
|
2004-07-01 18:12:37 -05:00
|
|
|
|
2004-07-01 18:01:36 -05:00
|
|
|
STRING/NIL body: if nil the body is considered omitted.
|
2004-07-01 18:12:37 -05:00
|
|
|
|
2004-07-01 18:01:36 -05:00
|
|
|
ARRAY images: the array may be empty.
|
2004-07-01 18:12:37 -05:00
|
|
|
|
2004-07-01 18:01:36 -05:00
|
|
|
STRING/NIL sound: if nil the sound is considered omitted.
|
2004-07-01 18:12:37 -05:00
|
|
|
|
|
|
|
DICT actions: each dictionary key is the localized name of the
|
|
|
|
action, and each key maps to a UINT32 containing an action
|
|
|
|
code. This code will be reported back to the client if the action
|
|
|
|
is invoked by the user.
|
|
|
|
|
2004-08-11 04:27:00 -05:00
|
|
|
DICT hints: optional hints that can be passed to the server from the
|
|
|
|
client. Although clients and servers should never assume to support such
|
|
|
|
hints, they can be used to pass along information such as the process
|
|
|
|
PID or window ID. See the HINTS section.
|
|
|
|
|
2004-07-13 19:08:12 -05:00
|
|
|
UINT32/NIL expire time: if nil the notification never times out.
|
|
|
|
If non-nil, a UNIX time_t (since the epoch) at which point the notification
|
|
|
|
will be automatically closed. If zero, use the default server timeout.
|
2004-07-13 19:10:21 -05:00
|
|
|
|
2004-08-11 04:27:00 -05:00
|
|
|
|
2004-07-13 19:10:21 -05:00
|
|
|
If replaces is NIL, return is a UINT32 that will never be reused
|
|
|
|
within a session unless more than MAXINT notifications have been
|
|
|
|
generated (ie an acceptable implementation for this is just an
|
|
|
|
incrementing counter). The returned UINT32 will never be zero, as
|
|
|
|
this is an invalid ID.
|
|
|
|
|
|
|
|
If replaces is not NIL, return is the same as replaces.
|
2004-07-01 18:01:36 -05:00
|
|
|
|
2004-07-03 13:21:37 -05:00
|
|
|
* CloseNotification
|
2004-07-01 18:01:36 -05:00
|
|
|
|
|
|
|
This message indicates that the notification should be removed from
|
|
|
|
the users view. It can be used, for instance, if the event the
|
|
|
|
notification pertains to is no longer relevant or to cancel a
|
2004-07-04 16:09:58 -05:00
|
|
|
notification with no expiration. It takes one UINT32 parameter, the ID
|
2004-07-13 18:00:33 -05:00
|
|
|
of the notificaton to cancel. The NotificationClosed signal is emitted by this
|
|
|
|
method.
|
2004-07-01 18:01:36 -05:00
|
|
|
|
2004-07-01 18:05:12 -05:00
|
|
|
* GetServerInformation
|
|
|
|
|
2004-07-29 16:02:55 -05:00
|
|
|
This message takes no parameters, and returns the following values in an array:
|
2004-07-01 18:05:12 -05:00
|
|
|
|
|
|
|
STRING name: the product name of the server
|
|
|
|
STRING vendor: "kde"/"freedesktop.org"/"Microsoft" etc etc
|
|
|
|
STRING version: a version spec of arbitrary format
|
|
|
|
|
2004-07-01 18:12:37 -05:00
|
|
|
All implementations must emit the following signals:
|
|
|
|
|
2004-07-03 13:21:37 -05:00
|
|
|
* NotificationClosed
|
2004-07-01 18:12:37 -05:00
|
|
|
|
|
|
|
A completed notification is one that has timed out, or been
|
|
|
|
dismissed by the user.
|
|
|
|
|
|
|
|
Has two parameters:
|
|
|
|
|
|
|
|
* UINT32 id: containing the ID of the notification that was
|
|
|
|
completed.
|
2004-07-04 16:09:58 -05:00
|
|
|
* UINT32 reason: 1 for expires, 2 for being dismissed by the user,
|
2004-07-01 18:12:37 -05:00
|
|
|
3 for "other".
|
|
|
|
|
|
|
|
The ID specified in the signal is invalidated *before* the signal
|
|
|
|
is sent and may not be used in any further communications with the
|
|
|
|
server.
|
|
|
|
|
|
|
|
The following signals MAY be emitted by the server.
|
|
|
|
|
2004-07-29 16:02:55 -05:00
|
|
|
* Invoked
|
2004-07-01 18:12:37 -05:00
|
|
|
|
2004-07-29 16:02:55 -05:00
|
|
|
This signal is emitted when:
|
|
|
|
|
|
|
|
- The user performs some global "invoking" action upon a notification,
|
|
|
|
for instance by clicking on its graphical representation
|
|
|
|
- The user invokes a specific action as specified in the original
|
|
|
|
Notify request, for example by clicking on the action button.
|
2004-07-03 13:21:37 -05:00
|
|
|
|
|
|
|
ActionInvoked has two parameters:
|
|
|
|
|
|
|
|
* UINT32 id: The ID of the notification containing the invoked action.
|
|
|
|
|
2004-07-29 16:02:55 -05:00
|
|
|
* UINT32 action_id: Zero means the default invoke action that can be
|
|
|
|
performed on any notification. 1+ is the index in
|
|
|
|
the actions array originally specified.
|
2004-07-01 18:12:37 -05:00
|
|
|
|
2004-07-29 16:02:55 -05:00
|
|
|
Clients should not assume the server will generate this signal: some
|
|
|
|
servers may not support user interaction at all, or may not support
|
|
|
|
the concept of being able to "invoke" a notification.
|
2004-07-06 16:18:00 -05:00
|
|
|
|