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 Since: version 2
98
99 * ``icon`` (``v``)
100
101 A serialized icon to add to the notification.
102 The icon must pass `icon validation <icons.html>`_ in order to be used.
103 The format for serialized icon is a tuple (sv) with the following
104 supported keys:
105
106 * ``themed`` (``as``)
107
108 A themed icon containing an array of strings with the icon names.
109
110 This is the same format as a
111 `serialized <https://docs.gtk.org/gio/method.Icon.to_string.html>`_
112 `GThemedIcon <https://docs.gtk.org/gio/class.ThemedIcon.html>`_ at
113 the moment, but this interoperability may change in the future.
114
115 * ``bytes`` (``ay``)
116
117 The icon bytes into a variant bytes array.
118
119 This is the same format as a
120 `serialized <https://docs.gtk.org/gio/method.Icon.to_string.html>`_
121 `GBytesIcon <https://docs.gtk.org/gio/class.BytesIcon.html>`_ at the
122 moment, but this interoperability may change in the future.
123
124 Since version 2, this is deprecated and should not be used.
125 Please use the `themed` or `file-descriptor` option to set an icon.
126
127 * ``file-descriptor`` (``h``)
128
129 A file descriptor to an image file in png, jpeg or svg form.
130 The file-descriptor used needs to be sealable, currently this is only
131 possible for file descriptors created with ``memfd_create()`` with
132 the ``MFD_ALLOW_SEALING`` flag set.
133
134 Since: version 2
135
136 For historical reasons, it is also possible to send a simple string
137 for themed icons with a single icon name.
138
139 There may be further restrictions on the supported kinds of icons.
140
141 * ``sound`` (``v``)
142
143 A serialized sound to add to the notification.
144 Supported sound formats are ogg/opus, ogg/vorbis and wav/pcm.
145
146 The format for
147 serialized sound is a tuple (sv) with the following supported keys:
148
149 * ``file-descriptor`` (``h``)
150
151 A file descriptor to a sound file.
152 The file-descriptor used needs to be sealable, currently this is only
153 possible for file descriptors created with ``memfd_create()`` with
154 the ``MFD_ALLOW_SEALING`` flag set.
155
156 To play the default sound the string ``default`` can be passed.
157 To play no sound at all the string ``silent`` can be passed.
158 If this property isn't specified the notification server can decide
159 whether to play a sound.
160
161 There may be further restrictions on the supported kinds of sounds.
162
163 Since: version 2
164
165 * ``priority`` (``s``)
166
167 The priority for the notification. Supported values:
168
169 - ``low``
170 - ``normal``
171 - ``high``
172 - ``urgent``
173
174 * ``default-action`` (``s``)
175
176 Name of an action that is exported by the application. This
177 action will be activated when the user clicks on the notification.
178
179 * ``default-action-target`` (``v``)
180
181 Target parameter to send along when activating the default action.
182
183 * ``buttons`` (``aa{sv}``)
184
185 Array of serialized buttons to add to the notification. The format for
186 serialized buttons is a vardict with the following supported keys:
187
188 * ``label`` (``s``)
189
190 User-visible label for the button. Mandatory, if no purpose
191 is specified. It is strongly recommended to always provide
192 sensible label. Buttons without a ``label`` are ignored
193 by the server when it doesn't understand the ``purpose`` or
194 is needed to display the button.
195
196 * ``action`` (``s``)
197
198 Name of an action that is exported by the application. The action
199 will be activated when the user clicks on the button. Mandatory.
200
201 * ``target`` (``v``)
202
203 Target parameter to send along when activating the action.
204
205 * ``purpose`` (``s``)
206
207 The ``purpose`` of the button. This information may be used by the
208 notification server to treat the button specially.
209
210 Depending on the ``purpose`` other fields of the button may be ignored.
211 If the server doesn't understand the ``purpose`` it will be
212 ignored and the button will be shown as a normal button.
213
214 Most standardized hints are defined as part of a ``category``.
215 Additional purposes may be defined by notification servers using
216 ``x-vendor`` prefix e.g. ``x-gnome.class.specific``
217
218 The following purposes are defined outside of a ``category``:
219
220 * ``system.custom-alert``:
221
222 Not a button in a strict sense. This action may be called,
223 depending on system policies, automatically by the notification
224 server whenever the notification is shown.
225
226 This allows apps to use custom methods for notifying the user,
227 for example, to play audio from a special
228 source like a streaming service or a radio station.
229
230 No ``label`` should be given when this purpose is used, so that
231 the server can ignore the button if it doesn't understand the purpose.
232
233 Since: version 2
234
235 * ``display-hint`` (``as``)
236
237 An array of ways to display the notification. If none are set, or the notification server has its own policy, it is
238 free to decide how and where to display the notification.
239
240 * ``transient``
241
242 The notification is displayed only as a banner and won't be kept
243 by the server in a tray.
244
245 It's a programmer error to specify ``tray`` at the same time.
246
247 * ``tray``
248
249 No banner for the notification will be displayed and
250 the notification is placed in the tray.
251
252 It's a programmer error to specify ``transient`` at the same time.
253
254 * ``persistent``
255
256 Make the notification persistent in the notification tray.
257 The user can’t dismiss it using the usual close button or gesture.
258
259 Apps are only allowed to display persistent notifications
260 as long as they have a window. Once the last window of an app
261 is closed the persistent notification will be removed.
262
263 * ``hide-on-lockscreen``
264
265 Don't show the notification on the lockscreen.
266
267 * ``hide-content-on-lockscreen``
268
269 All content of the notification will be hidden on the lockscreen.
270
271 * ``show-as-new``
272
273 If a notification with the same ``id`` of the app exists already
274 replace the previous notification, by removing the old notification
275 (including animation, etc) and adding a new notification.
276
277 If this hint isn't specified the notification's content is updated
278 without any flickering.
279
280 Since: version 2
281
282 * ``category`` (``s``)
283
284 The ``category`` describes the content of a notification.
285 A notification server may use this information to display the
286 notification specially. Some categories also include
287 button purposes that can be set for a button so that the notification
288 can know the purpose of the button.
289
290 Additional categories and button purposes may be defined by notification servers
291 using ``x-vendor`` prefix e.g. ``x-gnome.class.specific``
292
293 The following categories are standarized so far:
294
295 * ``im.received``
296
297 Intended for instant messaging apps displaying notifications for new messages.
298
299 This category has the following button purposes:
300
301 * ``im.reply-with-text``:
302
303 Inline replies for instant messaging.
304 The user-provided text will be added to the response.
305
306 The user response (``s``) will be placed as the second value
307 in the parameter array of exported actions.
308 For non-exported actions it will be placed as the third value
309 in the parameter array of #org.freedesktop.portal.Notification::ActionInvoked.
310
311 * ``alarm.ringing``
312
313 Intended for alarm clock apps
314
315 * ``call.incoming``
316
317 Intended for call apps to notify the user about an incoming call.
318
319 This category has the following button purposes:
320
321 * ``call.accept``:
322
323 Accept the incoming call.
324
325 * ``call.decline``:
326
327 Decline the incoming call.
328
329 * ``call.ongoing``
330
331 Intended for call apps while a call is ongoing.
332
333 This type has the following button purposes:
334
335 * ``call.hang-up``:
336
337 Hang up the ongoing call.
338
339 * ``call.enable-speakerphone``:
340
341 Enable the speakerphone for the ongoing call.
342
343 * ``call.disable-speakerphone``:
344
345 Disable the speakerphone for the ongoing call.
346
347 * ``call.unanswered``
348
349 Intended to be used by call apps when a call was missed.
350
351 * ``weather.warning.extreme``
352
353 Intended to be used to display an extreme weather warning.
354
355 * ``cellbroadcast.danger.presidential``
356
357 Intended to be used to display nationwide or presidential warnings broadcasted by the cell network.
358
359 * ``cellbroadcast.danger.extreme``
360
361 Intended to be used to display extreme danger warnings broadcasted by the cell network.
362
363 * ``cellbroadcast.danger.severe``
364
365 Intended to be used to display severe danger warnings broadcasted by the cell network.
366
367 * ``cellbroadcast.public-safety``
368
369 Intended to be used to display public safety warnings broadcasted by the cell network.
370
371 * ``cellbroadcast.amber-alert``
372
373 Intended to be used to display amber alerts broadcasted by the cell network.
374
375 * ``cellbroadcast.test``
376
377 Intended to be used to display tests broadcasted by the cell network.
378
379 * ``os.battery.low``
380
381 Intended to be used to indicate that the system is low on battery.
382
383 * ``browser.web-notification``
384
385 Intended to be used by browsers to mark notifications send by websites via
386 the `Notifications API <https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API>`_.
387
388 Since: version 2
389 -->
390 <method name="AddNotification">
391 <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
392 <arg type="s" name="id" direction="in"/>
393 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
394 <arg type="a{sv}" name="notification" direction="in"/>
395 </method>
396 <!--
397 RemoveNotification:
398 @id: Application-provided ID for this notification
399
400 Withdraws a notification.
401 -->
402 <method name="RemoveNotification">
403 <arg type="s" name="id" direction="in"/>
404 </method>
405
406 <!--
407 SupportedOptions:
408
409 Some properties in :ref:`org.freedesktop.portal.Notification.AddNotification`
410 may have options advertised by the server.
411
412 Currently there are the following options the notification server can advertise:
413
414 * ``category`` (``as``)
415
416 Categories that the notification server understands and supports.
417
418 * ``button-purpose`` (``as``)
419
420 Button purposes that the notification server understands and supports.
421 This is the list of options that can be used as `purpose` for `buttons`.
422
423 Since: version 2
424 -->
425 <property name="SupportedOptions" type="a{sv}" access="read">
426 <annotation name="org.qtproject.QtDBus.QtTypeName" value="QVariantMap"/>
427 </property>
428
429 <!--
430 ActionInvoked:
431 @id: the application-provided ID for the notification
432 @action: the name of the action
433 @parameter: an array containing additional information
434
435 Send to the application when a non-exported action is
436 activated.
437
438 The @parameter contains the following values in order:
439
440 #. The `target` for the action, if one was specified.
441
442 #. The `platform-data` as vardict (``a{sv}``) containing an ``activation-token`` (``s``) for
443 `XDG Activation
444 <https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/xdg-activation-v1.xml>`_
445
446 Since: version 2
447
448 #. The user `response` for an action based on the purpose if applicable.
449
450 Since: version 2
451 -->
452 <signal name="ActionInvoked">
453 <arg type="s" name="id"/>
454 <arg type="s" name="action"/>
455 <arg type="av" name="parameter"/>
456 </signal>
457 <property name="version" type="u" access="read"/>
458 </interface>
459 </node>