Debian Codegraph @

data/org.freedesktop.portal.Notification.xml

raw
1 <?xml version="1.0"?>
2 <!--
3 Copyright (C) 2016 Red Hat, Inc.
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library. If not, see <http://www.gnu.org/licenses/>.
19
20 Author: Matthias Clasen <[email protected]>
21 -->
22
23 <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
24 <!--
25 org.freedesktop.portal.Notification:
26 @short_description: Portal for sending notifications
27
28 This simple interface lets sandboxed applications send and withdraw
29 notifications. It is not possible for the application to learn
30 if the notification was actually presented to the user. Not a
31 portal in the strict sense, since there is no user interaction.
32
33 Note that in contrast to most other portal requests, notifications
34 are expected to outlast the running application. If a user clicks
35 on a notification after the application has exited, it will get
36 activated again.
37
38 Notifications can specify actions that can be activated by the
39 user. Actions whose name starts with 'app.' are assumed to be
40 exported (without the 'app.' prefix) and will be activated via
41 `D-Bus Activation
42 <https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s08.html>`_
43 using ``ActivateAction()`` method in the
44 ``org.freedesktop.Application`` interface. An `activation-token` for
45 `XDG Activation
46 <https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/xdg-activation-v1.xml>`_
47 and an application-defined `target` is passed when activating the action.
48 Other actions are activated by sending the
49 #org.freedesktop.portal.Notification::ActionInvoked signal
50 to the application.
51
52 This documentation describes version 2 of this interface.
53 -->
54 <interface name="org.freedesktop.portal.Notification">
55 <!--
56 AddNotification:
57 @id: Application-provided ID for this notification
58 @notification: Vardict with the serialized notification
59
60 Sends a notification.
61
62 The ID can be used to later withdraw the notification.
63 If the application reuses the same ID without withdrawing,
64 the notification is updated with the new one. It's possible
65 to set ``show-as-new`` hint in the ``display-hint`` property
66 to animate replacing the notification instead of updating it.
67
68 The format of the serialized notification is a vardict, with
69 the following supported keys, all of which are optional:
70
71 * ``title`` (``s``)
72
73 User-visible string to display as the title.
74
75 This should be a short string, if it doesn't fit the UI it may
76 be truncated to fit on a single line.
77
78 * ``body`` (``s``)
79
80 User-visible string to display as the body.
81
82 This can be a long string but if it doesn't fit the UI it may
83 be wrapped or/and truncated.
84
85 * ``markup-body`` (``s``)
86
87 The same as ``body`` but with support for markup formatting.
88 The markup is XML-based and supports a small subset of HTML
89 ``<b>...</b>``, ``<i>...</i>`` and ``<a href="...">...</a>``.
90
91 Any markup not supported, e.g. new lines, will be removed from
92 the string. In the future, the set of supported markup may be extended.
93
94 This can be a long string but if it doesn't fit the UI it may
95 be wrapped or/and truncated.
96
97 * ``icon`` (``v``)
98
99 A serialized icon to add to the notification. The icon must pass
100 `icon validation <icons.html>`_ in order to be used. The format for
101 serialized icon is a tuple (sv) with the following supported keys:
102
103 * ``themed`` (``as``)
104
105 A themed icon containing an array of strings with the icon names.
106
107 This is the same format as a serialized `GThemedIcon
108 <https://docs.gtk.org/gio/class.ThemedIcon.html>`_ at the moment,
109 but this interoperability may change in the future.
110
111 * ``bytes`` (``ay``)
112
113 Since version 2, this is deprecated and should not be used.
114 Please use the `themed` or `file-descriptor` option to set an icon.
115
116 This is the same format as a serialized `GBytesIcon
117 <https://docs.gtk.org/gio/class.BytesIcon.html>`_ at the moment,
118 but this interoperability may change in the future.
119
120 * ``file-descriptor`` (``h``)
121
122 A file descriptor to an image file in png, jpeg or svg form.
123 The file-descriptor used needs to be sealable, currently this is only
124 possible for file descriptors created with ``memfd_create()`` with
125 the ``MFD_ALLOW_SEALING`` flag set.
126
127 For historical reasons, it is also possible to send a simple string
128 for themed icons with a single icon name.
129
130 There may be further restrictions on the supported kinds of icons.
131
132 * ``sound`` (``v``)
133
134 A serialized sound to add to the notification.
135 Supported sound formats are ogg/opus, ogg/vorbis and wav/pcm.
136
137 The format for
138 serialized sound is a tuple (sv) with the following supported keys:
139
140 * ``file-descriptor`` (``h``)
141
142 A file descriptor to a sound file.
143 The file-descriptor used needs to be sealable, currently this is only
144 possible for file descriptors created with ``memfd_create()`` with
145 the ``MFD_ALLOW_SEALING`` flag set.
146
147 To play the default sound the string ``default`` can be passed.
148 To play no sound at all the string ``silent`` can be passed.
149 If this property isn't specified the notification server can decide
150 whether to play a sound.
151
152 There may be further restrictions on the supported kinds of sounds.
153
154 * ``priority`` (``s``)
155
156 The priority for the notification. Supported values:
157
158 - ``low``
159 - ``normal``
160 - ``high``
161 - ``urgent``
162
163 * ``default-action`` (``s``)
164
165 Name of an action that is exported by the application. This
166 action will be activated when the user clicks on the notification.
167
168 * ``default-action-target`` (``v``)
169
170 Target parameter to send along when activating the default action.
171
172 * ``buttons`` (``aa{sv}``)
173
174 Array of serialized buttons to add to the notification. The format for
175 serialized buttons is a vardict with the following supported keys:
176
177 * ``label`` (``s``)
178
179 User-visible label for the button. Mandatory, if no purpose
180 is specified. It is strongly recommended to always provide
181 sensible label. Buttons without a ``label`` are ignored
182 by the server when it doesn't understand the ``purpose`` or
183 is needed to display the button.
184
185 * ``action`` (``s``)
186
187 Name of an action that is exported by the application. The action
188 will be activated when the user clicks on the button. Mandatory.
189
190 * ``target`` (``v``)
191
192 Target parameter to send along when activating the action.
193
194 * ``purpose`` (``s``)
195
196 The ``purpose`` of the button. This information may be used by the
197 notification server to treat the button specially.
198
199 Depending on the ``purpose`` other fields of the button may be ignored.
200 If the server doesn't understand the ``purpose`` it will be
201 ignored and the button will be shown as a normal button.
202
203 Most standardized hints are defined as part of a ``category``.
204 Additional purposes may be defined by notification servers using
205 ``x-vendor`` prefix e.g. ``x-gnome.class.specific``
206
207 The following purposes are defined outside of a ``category``:
208
209 * ``system.custom-alert``:
210
211 Not a button in a strict sense. This action may be called,
212 depending on system policies, automatically by the notification
213 server whenever the notification is shown.
214
215 This allows apps to use custom methods for notifying the user,
216 for example, to play audio from a special
217 source like a streaming service or a radio station.
218
219 No ``label`` should be given when this purpose is used, so that
220 the server can ignore the button if it doesn't understand the purpose.
221
222 * ``display-hint`` (``as``)
223
224 An array of ways to display the notification. If none are set, or the notification server has its own policy, it is
225 free to decide how and where to display the notification.
226
227 * ``transient``
228
229 The notification is displayed only as a banner and won't be kept
230 by the server in a tray.
231
232 It's a programmer error to specify ``tray`` at the same time.
233
234 * ``tray``
235
236 No banner for the notification will be displayed and
237 the notification is placed in the tray.
238
239 It's a programmer error to specify ``transient`` at the same time.
240
241 * ``persistent``
242
243 Make the notification persistent in the notification tray.
244 The user can’t dismiss it using the usual close button or gesture.
245
246 Apps are only allowed to display persistent notifications
247 as long as they have a window. Once the last window of an app
248 is closed the persistent notification will be removed.
249
250 * ``hide-on-lockscreen``
251
252 Don't show the notification on the lockscreen.
253
254 * ``hide-content-on-lockscreen``
255
256 All content of the notification will be hidden on the lockscreen.
257
258 * ``show-as-new``
259
260 If a notification with the same ``id`` of the app exists already
261 replace the previous notification, by removing the old notification
262 (including animation, etc) and adding a new notification.
263
264 If this hint isn't specified the notification's content is updated
265 without any flickering.
266
267 * ``category`` (``s``)
268
269 The ``category`` describes the content of a notification.
270 A notification server may use this information to display the
271 notification specially. Some categories also include
272 button purposes that can be set for a button so that the notification
273 can know the purpose of the button.
274
275 Additional categories and button purposes may be defined by notification servers
276 using ``x-vendor`` prefix e.g. ``x-gnome.class.specific``
277
278 The following categories are standarized so far:
279
280 * ``im.received``
281
282 Intended for instant messaging apps displaying notifications for new messages.
283
284 This category has the following button purposes:
285
286 * ``im.reply-with-text``:
287
288 Inline replies for instant messaging.
289 The user-provided text will be added to the response.
290
291 The user response (``s``) will be placed as the second value
292 in the parameter array of exported actions.
293 For non-exported actions it will be placed as the third value
294 in the parameter array of #org.freedesktop.portal.Notification::ActionInvoked.
295
296 * ``alarm.ringing``
297
298 Intended for alarm clock apps
299
300 * ``call.incoming``
301
302 Intended for call apps to notify the user about an incoming call.
303
304 This category has the following button purposes:
305
306 * ``call.accept``:
307
308 Accept the incoming call.
309
310 * ``call.decline``:
311
312 Decline the incoming call.
313
314 * ``call.ongoing``
315
316 Intended for call apps while a call is ongoing.
317
318 This type has the following button purposes:
319
320 * ``call.hang-up``:
321
322 Hang up the ongoing call.
323
324 * ``call.enable-speakerphone``:
325
326 Enable the speakerphone for the ongoing call.
327
328 * ``call.disable-speakerphone``:
329
330 Disable the speakerphone for the ongoing call.
331
332 * ``call.unanswered``
333
334 Intended to be used by call apps when a call was missed.
335
336 * ``weather.warning.extreme``
337
338 Intended to be used to display an extreme weather warning.
339
340 * ``cellbroadcast.danger.extreme``
341
342 Intended to be used to display extreme danger warnings broadcasted by the cell network.
343
344 * ``cellbroadcast.danger.severe``
345
346 Intended to be used to display severe danger warnings broadcasted by the cell network.
347
348 * ``cellbroadcast.amber-alert``
349
350 Intended to be used to display amber alerts broadcasted by the cell network.
351
352 * ``cellbroadcast.test``
353
354 Intended to be used to display tests broadcasted by the cell network.
355
356 * ``os.battery.low``
357
358 Intended to be used to indicate that the system is low on battery.
359
360 * ``browser.web-notification``
361
362 Intended to be used by browsers to mark notifications send by websites via
363 the `Notifications API <https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API>`_.
364 -->
365 <method name="AddNotification">
366 <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
367 <arg type="s" name="id" direction="in"/>
368 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
369 <arg type="a{sv}" name="notification" direction="in"/>
370 </method>
371 <!--
372 RemoveNotification:
373 @id: Application-provided ID for this notification
374
375 Withdraws a notification.
376 -->
377 <method name="RemoveNotification">
378 <arg type="s" name="id" direction="in"/>
379 </method>
380
381 <!--
382 SupportedOptions:
383
384 Some properties in :ref:`org.freedesktop.portal.Notification.AddNotification`
385 may have options advertised by the server.
386
387 Currently there are the following options the notification server can advertise:
388
389 * ``category`` (``as``)
390
391 Categories that the notification server understands and supports.
392
393 * ``button-purpose`` (``as``)
394
395 Button purposes that the notification server understands and supports.
396 This is the list of options that can be used as `purpose` for `buttons`.
397 -->
398 <property name="SupportedOptions" type="a{sv}" access="read">
399 <annotation name="org.qtproject.QtDBus.QtTypeName" value="QVariantMap"/>
400 </property>
401
402 <!--
403 ActionInvoked:
404 @id: the application-provided ID for the notification
405 @action: the name of the action
406 @parameter: an array containing additional information
407
408 Send to the application when a non-exported action is
409 activated.
410
411 The @parameter contains the following values in order:
412
413 #. The `target` for the action, if one was specified.
414
415 #. The `platform-data` as vardict (``a{sv}``) containing an ``activation-token`` (``s``) for
416 `XDG Activation
417 <https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/xdg-activation-v1.xml>`_
418
419 #. The user `response` for an action based on the purpose if applicable.
420 -->
421 <signal name="ActionInvoked">
422 <arg type="s" name="id"/>
423 <arg type="s" name="action"/>
424 <arg type="av" name="parameter"/>
425 </signal>
426 <property name="version" type="u" access="read"/>
427 </interface>
428 </node>