D-BUS Protocol

The following messages must be supported by all implementations.

Message commands

org.freedesktop.Notifications.GetCapabilities

STRING_ARRAY org.freedesktop.Notifications.GetCapabilities (void);

This message takes no parameters.

It returns an array of strings. Each string describes an optional capability implemented by the server. The following values are defined by this spec:

Table 4. Server Capabilities

"body" Supports body text. Some implementations may only show the summary (for instance, onscreen displays, marquee/scrollers)
"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.
"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 server to specify both.
"multi-image" The server will render an animation of all the frames 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.
"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-vendor". For instance, "x-gnome-foo-cap". Capability names must not contain spaces. They are limited to alpha-numeric characters and dashes ("-").

org.freedesktop.Notifications.Notify

UINT32 org.freedesktop.Notifications.Notify (STRING_OR_NIL app_name, BYTE_ARRAY_OR_STRING_OR_NIL app_icon, UINT32_OR_NIL replaces_id, STRING_OR_NIL notification_type, BYTE urgency_level, STRING summary, STRING_OR_NIL body, ARRAY images, DICT_OR_NIL actions, DICT_OR_NIL hints, UINT32_OR_NIL expire_time);

Sends a notification to the notification server.

Table 5. Notify Parameters

NameTypeDescription
app_nameSTRING or NIL The optional name of the application sending the notification.
app_iconBYTE_ARRAY or STRING or NIL The optional program icon of the calling application. This is in the same format as an image frame. See Icons.
replaces_idUINT32 or NIL The optional 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.
notification_typeSTRING or NIL The optional notification type ID, for potential server categorization and logging purposes. See Notification Types.
urgency_levelBYTEThe urgency level. See Urgency Levels.
summarySTRINGThe summary text briefly describing the notification.
bodySTRING or NILThe optional detailed body text.
imagesARRAY or NIL The optional array of images. See Icons.
actionsDICT or NIL A dictionary key of actions. Each key is the localized name of the action, as it should appear to the user, and maps to a UINT32 value containing a program-specific action code. This code will be reported back to the program if the action is invoked by the user.
hintsDICT or NIL Optional hints that can be passed to the server from the client program. Although clients and servers should never assume each other supports any specific hints, they can be used to pass along information, such as the process PID or window ID, that the server may be able to make use of. See Hints.
expire_timeUINT32 or NIL The notification time-out time, represented as UNIX-time (seconds since the epoch). If this is NIL, the notification will never time out, and will only be closed when an action is invoked. If non-NIL, this will specify a time at which the notification will be automatically closed. If zero, the server's default expiration time will be used.

If replaces_id is NIL, the return value is a UINT32 that represent the notification. It is unique, and will not be reused unless a MAXINT number of notifications have been generated. An acceptable implementation may just use an incrementing counter for the ID. The returned ID is always greater than zero. Servers must make sure not to return zero as an ID.

If replaces_id is not NIL, the returned value is the same value as replaces_id.

org.freedesktop.Notifications.CloseNotification

void org.freedesktop.Notifications.CloseNotification (UINT32 id);

Causes a notification to be forcefully closed and removed from the user's view. It can be used, for example, in the event that what the notification pertains to is no longer relevant, or to cancel a notification with no expiration time.

The NotificationClosed signal is emitted by this method.

If the notification no longer exists, an empty D-BUS Error message is sent back.

org.freedesktop.Notifications.GetServerInformation

void org.freedesktop.Notifications.GetServerInformation (out STRING name, out STRING vendor, out STRING version);

This message returns the information on the server. Specifically, the server name, vendor, and version number.

Table 6. GetServerInformation Return Values

NameTypeDescription
nameSTRINGThe product name of the server.
vendorSTRING The vendor name. For example, "KDE," "GNOME," "freedesktop.org," or "Microsoft."
versionSTRINGThe server's version number.

Signals

org.freedesktop.Notifications.NotificationClosed

org.freedesktop.Notifications.NotificationClosed (UINT32 id, UINT32 reason);

A completed notification is one that has timed out, or has been dismissed by the user.

Table 7. NotificationClosed Parameters

NameTypeDescription
idUINT32The ID of the notification that was closed.
reasonUINT32

The reason the notification was closed.

1 - The notification expired.

2 - The notification was dismissed by the user.

3 - The notification was closed by a call to CloseNotification.

4 - Undefined/reserved reasons.

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.

org.freedesktop.Notifications.ActionInvoked

org.freedesktop.Notifications.ActionInvoked (UINT32 id, UINT32 action_id);

This signal is emitted when one of the following occurs:

  • The user performs some global "invoking" action upon a notification. For instance, clicking somewhere on the notification itself.

  • The user invokes a specific action as specified in the original Notify request. For example, clicking on an action button.

Table 8. ActionInvoked Parameters

NameTypeDescription
idUINT32 The ID of the notification emitting the ActionInvoked signal.
action_idUINT32 The ID of the action invoked. A value of 0 means that the default action was invoked, i.e., clicking the notification itself. IDs greater than zero are the action IDs as defined by the calling application.

Note

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.