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 URL of the web app
131 being installed. This is displayed in the user-facing dialog.
132 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 name chosen by the user for the launcher.
149
150 * ``token`` (``s``)
151
152 Token that can be passed to a subsequent org.freedesktop.portal.DynamicLauncher.Install() call to
153 complete the installation without another dialog.
154 -->
155 <method name="PrepareInstall">
156 <arg type="s" name="parent_window" direction="in"/>
157 <arg type="s" name="name" direction="in"/>
158 <arg type="v" name="icon_v" direction="in"/>
159 <annotation name="org.qtproject.QtDBus.QtTypeName.In3" value="QVariantMap"/>
160 <arg type="a{sv}" name="options" direction="in"/>
161 <arg type="o" name="handle" direction="out"/>
162 </method>
163 <!--
164 RequestInstallToken:
165 @name: The name that will be used in the desktop file
166 @icon_v: A ``GBytesIcon`` icon as returned by ``g_icon_serialize()``. Must be a png or jpeg no larger than 512x512, or an svg
167 @options: Vardict with optional further information
168 @token: the token to be used with the org.freedesktop.portal.DynamicLauncher.Install() method
169
170 This method is intended for use only by specific components that
171 have their application ID allowlisted in the portal backend (e.g. GNOME
172 Software and KDE Discover). It is otherwise not guaranteed to work.
173
174 The token returned by this method can be used to avoid the need for a
175 confirmation dialog; the token can be passed to the Install() method
176 just as if it were acquired via the PrepareInstall() method.
177
178 The @options vardict currently has no supported entries.
179 -->
180 <method name="RequestInstallToken">
181 <arg type="s" name="name" direction="in"/>
182 <arg type="v" name="icon_v" direction="in"/>
183 <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
184 <arg type="a{sv}" name="options" direction="in"/>
185 <arg type="s" name="token" direction="out"/>
186 </method>
187 <!--
188 Uninstall:
189 @desktop_file_id: The .desktop file name
190 @options: Vardict with optional further information
191
192 This method deletes the desktop file and corresponding icon from the
193 appropriate directories to remove the launcher referred to by
194 @desktop_file_id.
195
196 The @desktop_file_id must have ``.desktop`` as a suffix. Except in the
197 special case when the calling process has no associated app ID,
198 @desktop_file_id must have the app ID followed by a period as a prefix,
199 regardless of whether the calling process is sandboxed or unsandboxed.
200
201 For example, Epiphany, which has the app ID "org.gnome.Epiphany"
202 in stable builds, might use a @desktop_file_id like
203 ``org.gnome.Epiphany.WebApp_e9d0e1e4b0a10856aa3b38d9eb4375de4070d043.desktop``
204 In that example the desktop file would exist at the path
205 ``~/.local/share/xdg-desktop-portal/applications/org.gnome.Epiphany.WebApp_e9d0e1e4b0a10856aa3b38d9eb4375de4070d043.desktop``
206 with a sym link in ``~/.local/share/applications/``.
207 The checksum at the end of the file name is an implementation detail in
208 Epiphany and not required by the portal.
209
210 This method is intended to be called by the application that created the
211 launcher, e.g. a web browser, so it can clean up associated data as part
212 of the uninstallation. Consequently, the proper way for a software center
213 to remove a launcher is by using the APIs provided by the application
214 that installed it. For example, for GNOME Software to remove web
215 launchers created by Epiphany, it would use the
216 ``org.gnome.Epiphany.WebAppProvider`` D-Bus interface.
217
218 Please note that this method call will fail if the specified launcher
219 already does not exist.
220
221 The @options vardict currently has no supported entries.
222 -->
223 <method name="Uninstall">
224 <arg type="s" name="desktop_file_id" direction="in"/>
225 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
226 <arg type="a{sv}" name="options" direction="in"/>
227 </method>
228 <!--
229 GetDesktopEntry:
230 @desktop_file_id: The .desktop file name
231 @contents: the contents of the named .desktop file
232
233 This function returns the contents of a desktop file with the name
234 @desktop_file_id in @contents.
235
236 The @desktop_file_id must have ".desktop" as a suffix. Except in the
237 special case when the calling process has no associated app ID,
238 @desktop_file_id must have the app ID followed by a period as a prefix.
239
240 This method only works for desktop files that were created by the
241 dynamic launcher portal.
242 -->
243 <method name="GetDesktopEntry">
244 <arg type="s" name="desktop_file_id" direction="in"/>
245 <arg type="s" name="contents" direction="out"/>
246 </method>
247 <!--
248 GetIcon:
249 @desktop_file_id: The .desktop file name
250 @icon_v: the icon as a serialized #GBytesIcon
251 @icon_format: one of "png", "jpeg", "svg"
252 @icon_size: the width and height in pixels of the icon
253
254 This function returns the contents of the icon specified in the "Icon"
255 key of the desktop file with the name @desktop_file_id in @icon_v. The
256 icon #GVariant can be passed to g_icon_deserialize() to reconstruct the
257 #GIcon.
258
259 The @desktop_file_id must have ".desktop" as a suffix. Except in the
260 special case when the calling process has no associated app ID,
261 @desktop_file_id must have the app ID followed by a period as a prefix.
262
263 The format and size of the icon are returned in @icon_format and
264 @icon_size. For svg icons, @icon_size is currently always set to 4096,
265 but don't depend on that as it may change in the future.
266
267 This method only works for desktop files that were created by the
268 dynamic launcher portal.
269 -->
270 <method name="GetIcon">
271 <arg type="s" name="desktop_file_id" direction="in"/>
272 <arg type="v" name="icon_v" direction="out"/>
273 <arg type="s" name="icon_format" direction="out"/>
274 <arg type="u" name="icon_size" direction="out"/>
275 </method>
276 <!--
277 Launch:
278 @desktop_file_id: The .desktop file name
279 @options: Vardict with optional further information
280
281 This function launches the app specified by @desktop_file_id.
282
283 The @desktop_file_id must have ".desktop" as a suffix. Except in the
284 special case when the calling process has no associated app ID,
285 @desktop_file_id must have the app ID followed by a period as a prefix.
286
287 This method only works for desktop files that were created by the
288 dynamic launcher portal.
289
290 Supported keys in the @options vardict include:
291
292 * ``activation_token`` (``s``)
293
294 A token that can be used to activate the chosen application.
295 -->
296 <method name="Launch">
297 <arg type="s" name="desktop_file_id" direction="in"/>
298 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
299 <arg type="a{sv}" name="options" direction="in"/>
300 </method>
301 <!--
302 SupportedLauncherTypes:
303
304 A bitmask of available launcher types. Currently defined types are:
305
306 - 1: Application. A launcher that represents an application.
307 - 2: Webapp. A launcher that represents a web app.
308 -->
309 <property name="SupportedLauncherTypes" type="u" access="read"/>
310 <property name="version" type="u" access="read"/>
311 </interface>
312 </node>