Debian Codegraph @

data/org.freedesktop.portal.DynamicLauncher.xml

raw
1 <?xml version="1.0"?>
2 <!--
3 Copyright (C) 2021 Matthew Leeds
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: Matthew Leeds <[email protected]>
21 -->
22
23 <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
24 <!--
25 org.freedesktop.portal.DynamicLauncher:
26 @short_description: Portal for installing application launchers
27
28 The DynamicLauncher portal allows sandboxed (or unsandboxed) applications
29 to install launchers (.desktop files) which have an icon associated with them
30 and which execute a command in the application. The desktop environment
31 would display the launcher to the user in its menu of installed applications.
32 For example this can be used by a sandboxed browser to install web app
33 launchers. The portal also allows apps to uninstall the launchers, launch
34 them, and read the desktop file and icon data for them.
35
36 The standard way to install a launcher is to use the
37 org.freedesktop.portal.DynamicLauncher.PrepareInstall() method
38 which results in a dialog being presented to the user so they can confirm
39 they want to install the launcher. Then, the token returned by
40 org.freedesktop.portal.DynamicLauncher.PrepareInstall()
41 would be passed to the org.freedesktop.portal.DynamicLauncher.Install()
42 method to complete the installation.
43
44 However, in the rare circumstance that an unsandboxed process such as a
45 system component needs to install a launcher without user interaction, this
46 can be accomplished by using the org.freedesktop.portal.DynamicLauncher.RequestInstallToken()
47 method and passing the acquired token to org.freedesktop.portal.DynamicLauncher.Install().
48
49 This documentation describes version 1 of this interface.
50 -->
51 <interface name="org.freedesktop.portal.DynamicLauncher">
52 <!--
53 Install:
54 @token: Token proving authorization of the installation
55 @desktop_file_id: The ``.desktop`` file name to be used
56 @desktop_entry: The text of the Desktop Entry file to be installed, see below
57 @options: Vardict with optional further information
58
59 Installs a .desktop launcher and icon into appropriate directories to
60 allow the desktop environment to find them. Please note that this method
61 overwrites any existing launcher with the same id. If you want to
62 present the user with a confirmation dialog in that case, you can check
63 for it using the org.freedesktop.portal.DynamicLauncher.GetDesktopEntry()
64 method and clean up any state from the previous launcher if you want.
65
66 @token must be a token that was returned by a previous
67 org.freedesktop.portal.DynamicLauncher.PrepareInstall() or
68 org.freedesktop.portal.DynamicLauncher.RequestInstallToken() call.
69 The token can only be used once and is valid for up to five minutes.
70
71 The icon and name used for the launcher will be the ones from the previous
72 org.freedesktop.portal.DynamicLauncher.PrepareInstall() or
73 org.freedesktop.portal.DynamicLauncher.RequestInstallToken() call.
74
75 The @desktop_file_id must have ".desktop" as a suffix. Except in the
76 special case when the calling process has no associated app ID,
77 @desktop_file_id must have the app ID followed by a period as a prefix,
78 regardless of whether the calling process is sandboxed or unsandboxed.
79
80 The @desktop_entry should be a valid desktop entry file beginning with
81 ``[Desktop Entry]``, except it should not include ``Name=`` or ``Icon=`` entries
82 (if present, these will be overwritten by the portal implementation).
83 The ``Exec=`` entry will be rewritten to call the sandboxed application e.g.
84 via "flatpak run", if the application is sandboxed.
85
86 It is recommended to include a ``TryExec=`` line with either a binary name
87 or an absolute path. The launcher will be deleted if the ``TryExec`` binary
88 cannot be found on session start.
89
90 The @options vardict currently has no supported entries.
91 -->
92 <method name="Install">
93 <arg type="s" name="token" direction="in"/>
94 <arg type="s" name="desktop_file_id" direction="in"/>
95 <arg type="s" name="desktop_entry" direction="in"/>
96 <annotation name="org.qtproject.QtDBus.QtTypeName.In3" value="QVariantMap"/>
97 <arg type="a{sv}" name="options" direction="in"/>
98 </method>
99 <!--
100 PrepareInstall:
101 @parent_window: Identifier for the application window, see :doc:`window-identifiers`
102 @name: The default name for the launcher
103 @icon_v: A ``GBytesIcon`` icon as returned by ``g_icon_serialize()``. Must be a png or jpeg no larger than 512x512, or an svg
104 @options: Vardict with optional further information
105 @handle: Object path for the :ref:`org.freedesktop.portal.Request` object representing this call
106
107 Presents a dialog to the user to allow them to see the icon, potentially
108 change the name, and confirm installation of the launcher.
109
110 Supported keys in the @options vardict:
111
112 * ``handle_token`` (``s``)
113
114 A string that will be used as the last element of the @handle. Must be a valid
115 object path element. See the :ref:`org.freedesktop.portal.Request` documentation for
116 more information about the @handle.
117
118 * ``modal`` (``b``)
119
120 Whether to make the dialog modal. Defaults to true.
121
122 * ``launcher_type`` (``u``)
123
124 The type of launcher being created. For supported values see the
125 #org.freedesktop.portal.DynamicLauncher:SupportedLauncherTypes property.
126 Defaults to "Application".
127
128 * ``target`` (``s``)
129
130 For a launcher of type "Webapp", this is the URI, as described in RFC
131 3986, of the web app being installed. This is displayed in the
132 user-facing dialog. For other launcher types, this is not needed.
133
134 * ``editable_name`` (``b``)
135
136 If true, the user will be able to edit the name of the launcher.
137 Defaults to true.
138
139 * ``editable_icon`` (``b``)
140
141 If true, the user will be able to edit the icon of the launcher,
142 if the implementation supports this. Defaults to false.
143
144 The following results get returned via the :ref:`org.freedesktop.portal.Request::Response` signal:
145
146 * ``name`` (``s``)
147
148 The chosen name for the launcher. This can be either a user chosen
149 name, or the name passed in @name.
150
151 * ``icon`` (``v``)
152
153 The chosen icon for the launcher. This can be either a user chosen
154 icon, or the icon passed in @icon_v.
155
156 * ``token`` (``s``)
157
158 Token that can be passed to a subsequent org.freedesktop.portal.DynamicLauncher.Install() call to
159 complete the installation without another dialog.
160 -->
161 <method name="PrepareInstall">
162 <arg type="s" name="parent_window" direction="in"/>
163 <arg type="s" name="name" direction="in"/>
164 <arg type="v" name="icon_v" direction="in"/>
165 <annotation name="org.qtproject.QtDBus.QtTypeName.In3" value="QVariantMap"/>
166 <arg type="a{sv}" name="options" direction="in"/>
167 <arg type="o" name="handle" direction="out"/>
168 </method>
169 <!--
170 RequestInstallToken:
171 @name: The name that will be used in the desktop file
172 @icon_v: A ``GBytesIcon`` icon as returned by ``g_icon_serialize()``. Must be a png or jpeg no larger than 512x512, or an svg
173 @options: Vardict with optional further information
174 @token: the token to be used with the org.freedesktop.portal.DynamicLauncher.Install() method
175
176 This method is intended for use only by specific components that
177 have their application ID allowlisted in the portal backend (e.g. GNOME
178 Software and KDE Discover). It is otherwise not guaranteed to work.
179
180 The token returned by this method can be used to avoid the need for a
181 confirmation dialog; the token can be passed to the Install() method
182 just as if it were acquired via the PrepareInstall() method.
183
184 The @options vardict currently has no supported entries.
185 -->
186 <method name="RequestInstallToken">
187 <arg type="s" name="name" direction="in"/>
188 <arg type="v" name="icon_v" direction="in"/>
189 <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
190 <arg type="a{sv}" name="options" direction="in"/>
191 <arg type="s" name="token" direction="out"/>
192 </method>
193 <!--
194 Uninstall:
195 @desktop_file_id: The .desktop file name
196 @options: Vardict with optional further information
197
198 This method deletes the desktop file and corresponding icon from the
199 appropriate directories to remove the launcher referred to by
200 @desktop_file_id.
201
202 The @desktop_file_id must have ``.desktop`` as a suffix. Except in the
203 special case when the calling process has no associated app ID,
204 @desktop_file_id must have the app ID followed by a period as a prefix,
205 regardless of whether the calling process is sandboxed or unsandboxed.
206
207 For example, Epiphany, which has the app ID "org.gnome.Epiphany"
208 in stable builds, might use a @desktop_file_id like
209 ``org.gnome.Epiphany.WebApp_e9d0e1e4b0a10856aa3b38d9eb4375de4070d043.desktop``
210 In that example the desktop file would exist at the path
211 ``~/.local/share/xdg-desktop-portal/applications/org.gnome.Epiphany.WebApp_e9d0e1e4b0a10856aa3b38d9eb4375de4070d043.desktop``
212 with a sym link in ``~/.local/share/applications/``.
213 The checksum at the end of the file name is an implementation detail in
214 Epiphany and not required by the portal.
215
216 This method is intended to be called by the application that created the
217 launcher, e.g. a web browser, so it can clean up associated data as part
218 of the uninstallation. Consequently, the proper way for a software center
219 to remove a launcher is by using the APIs provided by the application
220 that installed it. For example, for GNOME Software to remove web
221 launchers created by Epiphany, it would use the
222 ``org.gnome.Epiphany.WebAppProvider`` D-Bus interface.
223
224 Please note that this method call will fail if the specified launcher
225 already does not exist.
226
227 The @options vardict currently has no supported entries.
228 -->
229 <method name="Uninstall">
230 <arg type="s" name="desktop_file_id" direction="in"/>
231 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
232 <arg type="a{sv}" name="options" direction="in"/>
233 </method>
234 <!--
235 GetDesktopEntry:
236 @desktop_file_id: The .desktop file name
237 @contents: the contents of the named .desktop file
238
239 This function returns the contents of a desktop file with the name
240 @desktop_file_id in @contents.
241
242 The @desktop_file_id must have ".desktop" as a suffix. Except in the
243 special case when the calling process has no associated app ID,
244 @desktop_file_id must have the app ID followed by a period as a prefix.
245
246 This method only works for desktop files that were created by the
247 dynamic launcher portal.
248 -->
249 <method name="GetDesktopEntry">
250 <arg type="s" name="desktop_file_id" direction="in"/>
251 <arg type="s" name="contents" direction="out"/>
252 </method>
253 <!--
254 GetIcon:
255 @desktop_file_id: The .desktop file name
256 @icon_v: the icon as a serialized #GBytesIcon
257 @icon_format: one of "png", "jpeg", "svg"
258 @icon_size: the width and height in pixels of the icon
259
260 This function returns the contents of the icon specified in the "Icon"
261 key of the desktop file with the name @desktop_file_id in @icon_v. The
262 icon #GVariant can be passed to g_icon_deserialize() to reconstruct the
263 #GIcon.
264
265 The @desktop_file_id must have ".desktop" as a suffix. Except in the
266 special case when the calling process has no associated app ID,
267 @desktop_file_id must have the app ID followed by a period as a prefix.
268
269 The format and size of the icon are returned in @icon_format and
270 @icon_size. For svg icons, @icon_size is currently always set to 4096,
271 but don't depend on that as it may change in the future.
272
273 This method only works for desktop files that were created by the
274 dynamic launcher portal.
275 -->
276 <method name="GetIcon">
277 <arg type="s" name="desktop_file_id" direction="in"/>
278 <arg type="v" name="icon_v" direction="out"/>
279 <arg type="s" name="icon_format" direction="out"/>
280 <arg type="u" name="icon_size" direction="out"/>
281 </method>
282 <!--
283 Launch:
284 @desktop_file_id: The .desktop file name
285 @options: Vardict with optional further information
286
287 This function launches the app specified by @desktop_file_id.
288
289 The @desktop_file_id must have ".desktop" as a suffix. Except in the
290 special case when the calling process has no associated app ID,
291 @desktop_file_id must have the app ID followed by a period as a prefix.
292
293 This method only works for desktop files that were created by the
294 dynamic launcher portal.
295
296 Supported keys in the @options vardict include:
297
298 * ``activation_token`` (``s``)
299
300 A token that can be used to activate the chosen application.
301 -->
302 <method name="Launch">
303 <arg type="s" name="desktop_file_id" direction="in"/>
304 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
305 <arg type="a{sv}" name="options" direction="in"/>
306 </method>
307 <!--
308 SupportedLauncherTypes:
309
310 A bitmask of available launcher types. Currently defined types are:
311
312 - 1: Application. A launcher that represents an application.
313 - 2: Webapp. A launcher that represents a web app.
314 -->
315 <property name="SupportedLauncherTypes" type="u" access="read"/>
316 <property name="version" type="u" access="read"/>
317 </interface>
318 </node>