summaryrefslogtreecommitdiffstats
path: root/plugins/epiphany/org.freedesktop.portal.DynamicLauncher.xml
blob: 65aa90e1fb09e7f873782a58fd03e44630df4560 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<?xml version="1.0"?>
<!--
 Copyright (C) 2021 Matthew Leeds

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library. If not, see <http://www.gnu.org/licenses/>.

 Author: Matthew Leeds <mwleeds@protonmail.com>
-->

<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
  <!--
      org.freedesktop.portal.DynamicLauncher:
      @short_description: Portal for installing application launchers onto the
        desktop

      The DynamicLauncher portal allows sandboxed (or unsandboxed) applications
      to install launchers (.desktop files) which have an icon associated with them
      and which execute a command in the application. The desktop environment
      would display the launcher to the user in its menu of installed applications.
      For example this can be used by a sandboxed browser to install web app
      launchers. The portal also allows apps to uninstall the launchers, launch
      them, and read the desktop file and icon data for them.

      The standard way to install a launcher is to use the PrepareInstall() method
      which results in a dialog being presented to the user so they can confirm
      they want to install the launcher. Then, the token returned by PrepareInstall()
      would be passed to the Install() method to complete the installation.

      However, in the rare circumstance that an unsandboxed process such as a
      system component needs to install a launcher without user interaction, this
      can be accomplished by using the RequestInstallToken() method and passing
      the acquired token to Install().

      This documentation describes version 1 of this interface.
  -->
  <interface name="org.freedesktop.portal.DynamicLauncher">
    <!--
        Install:
        @token: Token proving authorization of the installation
        @desktop_file_id: The .desktop file name to be used
        @desktop_entry: The text of the Desktop Entry file to be installed, see below
        @options: Vardict with optional further information

        Installs a .desktop launcher and icon into appropriate directories to
        allow the desktop environment to find them. Please note that this method
        overwrites any existing launcher with the same id. If you want to
        present the user with a confirmation dialog in that case, you can check
        for it using the GetDesktopEntry() method and clean up any state from
        the previous launcher if you want.

        @token must be a token that was returned by a previous
        org.freedesktop.portal.DynamicLauncher.PrepareInstall() or
        org.freedesktop.portal.DynamicLauncher.RequestInstallToken() call.
        The token can only be used once and is valid for up to five minutes.

        The icon and name used for the launcher will be the ones from the previous
        org.freedesktop.portal.DynamicLauncher.PrepareInstall() or
        org.freedesktop.portal.DynamicLauncher.RequestInstallToken() call.

        The @desktop_file_id must have ".desktop" as a suffix. Except in the
        special case when the calling process has no associated app ID,
        @desktop_file_id must have the app ID followed by a period as a prefix,
        regardless of whether the calling process is sandboxed or unsandboxed.

        The @desktop_entry should be a valid desktop entry file beginning with
        "[Desktop Entry]", except it should not include Name= or Icon= entries
        (if present, these will be overwritten by the portal implementation).
        The Exec= entry will be rewritten to call the sandboxed application e.g.
        via "flatpak run", if the application is sandboxed.

        It is recommended to include a TryExec= line with either a binary name
        or an absolute path. The launcher will be deleted if the TryExec binary
        cannot be found on session start.

        The @options vardict currently has no supported entries.
    -->
    <method name="Install">
      <arg type="s" name="token" direction="in"/>
      <arg type="s" name="desktop_file_id" direction="in"/>
      <arg type="s" name="desktop_entry" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
    </method>
    <!--
        PrepareInstall:
        @parent_window: Identifier for the application window, see <link linkend="parent_window">Common Conventions</link>
        @name: The default name for the launcher
        @icon_v: A #GBytesIcon icon as returned by g_icon_serialize(). Must be
          a png or jpeg no larger than 512x512, or an svg
        @options: Vardict with optional further information
        @handle: Object path for the #org.freedesktop.portal.Request object representing this call

        Presents a dialog to the user to allow them to see the icon, potentially
        change the name, and confirm installation of the launcher.

        Supported keys in the @options vardict:
        <variablelist>
          <varlistentry>
            <term>handle_token s</term>
            <listitem><para>
              A string that will be used as the last element of the @handle. Must be a valid
              object path element. See the #org.freedesktop.portal.Request documentation for
              more information about the @handle.
            </para></listitem>
          </varlistentry>
          <varlistentry>
            <term>modal b</term>
            <listitem><para>
              Whether to make the dialog modal. Defaults to yes.
            </para></listitem>
          </varlistentry>
          <varlistentry>
            <term>launcher_type u</term>
            <listitem><para>
              The type of launcher being created. For supported values see the
              SupportedLauncherTypes property. Defaults to "Application".
            </para></listitem>
          </varlistentry>
          <varlistentry>
            <term>target s</term>
            <listitem><para>
              For a launcher of type "Webapp", this is the URL of the web app
              being installed. This is displayed in the user-facing dialog.
              For other launcher types, this is not needed.
            </para></listitem>
          </varlistentry>
          <varlistentry>
            <term>editable_name b</term>
            <listitem><para>
              If true, the user will be able to edit the name of the launcher.
              Defaults to true.
            </para></listitem>
          </varlistentry>
          <varlistentry>
            <term>editable_icon b</term>
            <listitem><para>
              If true, the user will be able to edit the icon of the launcher,
              if the implementation supports this. Defaults to false.
            </para></listitem>
          </varlistentry>
        </variablelist>

        The following results get returned via the #org.freedesktop.portal.Request::Response signal:
        <variablelist>
          <varlistentry>
            <term>name s</term>
            <listitem><para>
              The name chosen by the user for the launcher.
            </para></listitem>
          </varlistentry>
          <varlistentry>
            <term>token s</term>
            <listitem><para>
              Token that can be passed to a subsequent org.freedesktop.portal.DynamicLauncher.Install() call to
              complete the installation without another dialog.
            </para></listitem>
          </varlistentry>
        </variablelist>
    -->
    <method name="PrepareInstall">
      <arg type="s" name="parent_window" direction="in"/>
      <arg type="s" name="name" direction="in"/>
      <arg type="v" name="icon_v" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
      <arg type="o" name="handle" direction="out"/>
    </method>
    <!--
        RequestInstallToken:
        @name: The name that will be used in the desktop file
        @icon_v: A #GBytesIcon icon as returned by g_icon_serialize(). Must be
          a png or jpeg no larger than 512x512, or an svg
        @options: Vardict with optional further information
        @token: the token to be used with the Install() method

        This method is intended for use only by specific components that
        have their application ID allowlisted in the portal backend (e.g. GNOME
        Software and KDE Discover). It is otherwise not guaranteed to work.

        The token returned by this method can be used to avoid the need for a
        confirmation dialog; the token can be passed to the Install() method
        just as if it were acquired via the PrepareInstall() method.

        The @options vardict currently has no supported entries.
    -->
    <method name="RequestInstallToken">
      <arg type="s" name="name" direction="in"/>
      <arg type="v" name="icon_v" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
      <arg type="s" name="token" direction="out"/>
    </method>
    <!--
        Uninstall:
        @desktop_file_id: The .desktop file name
        @options: Vardict with optional further information

        This method deletes the desktop file and corresponding icon from the
        appropriate directories to remove the launcher referred to by
        @desktop_file_id.

        The @desktop_file_id must have ".desktop" as a suffix. Except in the
        special case when the calling process has no associated app ID,
        @desktop_file_id must have the app ID followed by a period as a prefix,
        regardless of whether the calling process is sandboxed or unsandboxed.

        For example, Epiphany, which has the app ID "org.gnome.Epiphany"
        in stable builds, might use a @desktop_file_id like
        "org.gnome.Epiphany.WebApp_e9d0e1e4b0a10856aa3b38d9eb4375de4070d043.desktop"
        In that example the desktop file would exist at the path
        "~/.local/share/xdg-desktop-portal/applications/org.gnome.Epiphany.WebApp_e9d0e1e4b0a10856aa3b38d9eb4375de4070d043.desktop"
        with a sym link in "~/.local/share/applications/".
        The checksum at the end of the file name is an implementation detail in
        Epiphany and not required by the portal.

        This method is intended to be called by the application that created the
        launcher, e.g. a web browser, so it can clean up associated data as part
        of the uninstallation. Consequently, the proper way for a software center
        to remove a launcher is by using the APIs provided by the application
        that installed it. For example, for GNOME Software to remove web
        launchers created by Epiphany, it would use the
        org.gnome.Epiphany.WebAppProvider D-Bus interface.

        Please note that this method call will fail if the specified launcher
        already does not exist.

        The @options vardict currently has no supported entries.
    -->
    <method name="Uninstall">
      <arg type="s" name="desktop_file_id" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
    </method>
    <!--
        GetDesktopEntry:
        @desktop_file_id: The .desktop file name
        @contents: the contents of the named .desktop file

        This function returns the contents of a desktop file with the name
        @desktop_file_id in @contents.

        The @desktop_file_id must have ".desktop" as a suffix. Except in the
        special case when the calling process has no associated app ID,
        @desktop_file_id must have the app ID followed by a period as a prefix.

        This method only works for desktop files that were created by the
        dynamic launcher portal.
    -->
    <method name="GetDesktopEntry">
      <arg type="s" name="desktop_file_id" direction="in"/>
      <arg type="s" name="contents" direction="out"/>
    </method>
    <!--
        GetIcon:
        @desktop_file_id: The .desktop file name
        @icon_v: the icon as a serialized #GBytesIcon
        @icon_format: one of "png", "jpeg", "svg"
        @icon_size: the width and height in pixels of the icon

        This function returns the contents of the icon specified in the "Icon"
        key of the desktop file with the name @desktop_file_id in @icon_v. The
        icon #GVariant can be passed to g_icon_deserialize() to reconstruct the
        #GIcon.

        The @desktop_file_id must have ".desktop" as a suffix. Except in the
        special case when the calling process has no associated app ID,
        @desktop_file_id must have the app ID followed by a period as a prefix.

        The format and size of the icon are returned in @icon_format and
        @icon_size. For svg icons, @icon_size is currently always set to 4096,
        but don't depend on that as it may change in the future.

        This method only works for desktop files that were created by the
        dynamic launcher portal.
    -->
    <method name="GetIcon">
      <arg type="s" name="desktop_file_id" direction="in"/>
      <arg type="v" name="icon_v" direction="out"/>
      <arg type="s" name="icon_format" direction="out"/>
      <arg type="u" name="icon_size" direction="out"/>
    </method>
    <!--
        Launch:
        @desktop_file_id: The .desktop file name
        @options: Vardict with optional further onformation

        This function launches the app specified by @desktop_file_id.

        The @desktop_file_id must have ".desktop" as a suffix. Except in the
        special case when the calling process has no associated app ID,
        @desktop_file_id must have the app ID followed by a period as a prefix.

        This method only works for desktop files that were created by the
        dynamic launcher portal.

        Supported keys in the @options vardict include:
        <variablelist>
          <varlistentry>
            <term>activation_token s</term>
            <listitem><para>
              A token that can be used to activate the chosen application.
            </para><para>
              The activation_token option was introduced in version 1 of the interface.
            </para></listitem>
          </varlistentry>
        </variablelist>
    -->
    <method name="Launch">
      <arg type="s" name="desktop_file_id" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
    </method>
    <!--
        SupportedLauncherTypes:

        A bitmask of available launcher types. Currently defined types are:

        <simplelist>
          <member>1: Application. A launcher that represents an application.</member>
          <member>2: Webapp. A launcher that represents a web app.</member>
        </simplelist>
    -->
    <property name="SupportedLauncherTypes" type="u" access="read"/>
    <property name="version" type="u" access="read"/>
  </interface>
</node>