Skip to content

Commit

Permalink
Allow host apps to register themselves
Browse files Browse the repository at this point in the history
For host apps, we currently require applications to run inside a cgroup
with a name that allows xdg-desktop-portal to derive an application ID
from it. This does not work reliably, and while the situation can
improve, it's unlikely to ever be fool proof, as it in theory requires
every potential piece of software that launches other applications to
know how to launch it in a compatible way.

Cgroups is also a Linux specific API, which is problematic from a *nix
wide portability perspective.

To address this, introduce a host-only portal API that allows
applications to register their D-Bus connections, associating them with
an application ID. This moves back the burden of associating an
application with an application ID back to the application itself,
instead of the application launcher.

Applications calling this overrides any applicion ID derived from the
name fo the cgroup the application runs inside.
  • Loading branch information
jadahl committed Dec 2, 2024
1 parent 6b684ea commit 6c33ebe
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions data/org.freedesktop.host.portal.Registry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2024 Red Hat, Inc.
SPDX-License-Identifier: LGPL-2.1-or-later
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.1 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: Matthias Clasen <[email protected]>
-->

<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<!--
org.freedesktop.host.portal.Registry:
@short_description: Interface to associate D-Bus peers with application
ids.
This simple interface lets unsandboxed applications register their
D-Bus connections and associate it with an application ID that will be
used in portals.
This interface will not work with applications xdg-desktop-portal
identifies as sandboxed.
This documentation describes version 1 of this interface.
-->
<interface name="org.freedesktop.host.portal.Registry">
<!--
Register:
@app_id: Application identifier
@options: Vardict with optional further information
Register a D-Bus peer and associate it with an application ID. The
application ID must be able to match the basename of a .desktop file
that describes the application.
The application ID will be used in org.freedesktop.portal APIs to
associate a portal action with an application.
-->
<method name="Register">
<arg type="s" name="app_id" direction="in"/>
<arg type="a{sv}" name="options" direction="out"/>
</method>
<property name="version" type="u" access="read"/>
</interface>
</node>

0 comments on commit 6c33ebe

Please sign in to comment.