Moving a portal


Portals are a fundamental concept in flatpak. They are the way a sandboxed application can access information and services from the host in a safe, controlled way.

Most of the portals in use are implemented by a module called xdg-desktop-portal, with backend implementations for Gtk+ and KDE. Many of the portals in it, such as the important file chooser portal relies on a lowlevel portal called the document portal. It is a combined dbus and fuse service that controls access to files with fine-grained per-application permissions.

The snap developers are interested in using portals for snap packages, which is great for application developers as they only have to target a single API. However, historically the document portal was shipped as part of flatpak, which is suddenly a major problem.

To fix this we had to move the document portal from flatpak to xdg-desktop-portal, and I’m happy to announce that with todays releases of xdg-desktop-portal and flatpak we now achieved this.

Packagers need to be careful about this when updating to the new versions so that only one copy of the document portal is installed. The stable version of flatpak (0.10.4) can be built with or without the document portal, depending on what version of the desktop portal you have. The unstable flatpak release doesn’t have the document portal at all, and requires you to use the new desktop portal.

5 thoughts on “Moving a portal”

  1. Thanks for your work.
    I am working on a music player that would need to access directories instead of files. Is it already possible with the current portal APIs ?
    I have had a look some months ago and that seemed impossible.
    Where should I report and discuss such feature request ? I would be happy to make progress on that.

    1. Matthieu: It is not currently possible, and its not obvious how it would even work in a safe way.
      Best place to discuss this is probably on e.g. the flatpak mailing list.

  2. Not sure if this is the right place to ask, but is there a plan to support ‘privileged’ Wayland clients using flatpak?

    When I say ‘privileged clients’ I mean clients that can e.g. take a screenshot, query window positions of other clients etc.

    AFAIK right now there is no official ‘privileged client’ protocol on Wayland, only proprietary ones for KDE etc. However it seems that flatpak with its portals is a good match for such functionality for an ‘official’ Wayland protocol.

Leave a Reply

Your email address will not be published. Required fields are marked *