From Gentoo Wiki
< XDG(Redirected from Xdg-desktop-portal)
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

xdg-desktop-portal is a frontend to implementations of the xdg-desktop-portal interface. Backend implementations available on Gentoo include:


USE flags

USE flags for sys-apps/xdg-desktop-portal Desktop integration portal

flatpak Enable sys-apps/flatpak integration
geolocation Enable physical position determination
seccomp Use sys-apps/bubblewrap (which requires seccomp) to sandbox some functionality like icon handling
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)


root #emerge --ask sys-apps/xdg-desktop-portal

You will also need to ensure that one or more implementations appropriate to your environment are installed (e.g. gui-libs/xdg-desktop-portal-wlr).


As described in the portals.conf(5) man page, xdg-desktop-portal is configured via one or more files:

  • $XDG_CONFIG_HOME/xdg-desktop-portal/{*-}portals.conf
  • $XDG_CONFIG_DIRS/xdg-desktop-portal/{*-}portals.conf
  • /etc/xdg-desktop-portal/{*-}portals.conf
  • $XDG_DATA_HOME/xdg-desktop-portal/{*-}portals.conf
  • $XDG_DATA_DIRS/xdg-desktop-portal/{*-}portals.conf
  • /usr/share/xdg-desktop-portal/{*-}portals.conf

If none of these files are present, create a simple portals.conf file:

FILE ~/.config/portals.confExample portals.conf file
# Use xdg-desktop-portal-gtk for every portal interface...
# ... except for the Screencast, Screenshot and Settings (dark/light mode) interface

Each xdg-desktop-portal implementation has a configuration file itself; refer to the relevant package's documentation (e.g. xdg-desktop-portal-wlr(5)) for details.

If using a portal in a desktop environment other than the one for which it was designed (e.g. using the GNOME portal with Sway), you may need to modify the relevant portal file in /usr/share/xdg-desktop-portal/portals/, adding the value of XDG_CURRENT_DESKTOP to the value of the UseIn key, e.g.:

FILE /usr/share/xdg-desktop-portal/portals/gnome.portal
The UseIn key is deprecated, superseded by portals.conf files as described above. However, they are still in active use as of 2023-12-24.


xdg-desktop-portal is usually not called manually; instead, other other programs call it as required. However, you can run it manually to debug your configuration, using the -v option:

user $/usr/libexec/xdg-desktop-portal -v

See also