XDG/xdg-desktop-portal
xdg-desktop-portal is a frontend to implementations of the xdg-desktop-portal interface. Backend implementations available on Gentoo include:
- sys-apps/xdg-desktop-portal-gnome
- sys-apps/xdg-desktop-portal-gtk
- kde-plasma/xdg-desktop-portal-kde
- gui-libs/xdg-desktop-portal-lxqt
- gui-libs/xdg-desktop-portal-wlr
Installation
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) |
Emerge
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).
The following table describes the Portal interfaces (e.g. org.freedesktop.portal.FileChooser
) implemented by backends (e.g. gui-libs/xdg-desktop-portal-xapp). Note that a given environment might implement a particular interface outside of its backend - for example, in KDE, the Secret
interface is implemented by kde-frameworks/kwallet.
Interface | gnome | gtk | hyprland | kde | lxqt | wlr | xapp |
---|---|---|---|---|---|---|---|
Access | ? | ? | |||||
Account | ? | ? | |||||
AppChooser | ? | ? | |||||
Background | ? | ? | |||||
Camera | ? | ? | |||||
Clipboard | ? | ? | |||||
Documents | ? | ? | |||||
Dynamic Launcher | ? | ? | |||||
? | ? | ||||||
File Chooser | ? | ? | |||||
File Transfer | ? | ? | |||||
Game Mode | ? | ? | |||||
Global Shortcuts | ? | ? | |||||
Inhibit | ? | ? | |||||
Input Capture | ? | ? | |||||
Location | ? | ? | |||||
Lockdown | ? | ? | |||||
Memory Monitor | ? | ? | |||||
Network Monitor | ? | ? | |||||
Notification | ? | ? | |||||
OpenURI | ? | ? | |||||
Power Profile Monitor | ? | ? | |||||
? | ? | ||||||
Proxy Resolver | ? | ? | |||||
Realtime | ? | ? | |||||
Remote Desktop | ? | ? | |||||
Request | ? | ? | |||||
ScreenCast | ? | ? | |||||
Screenshot | ? | ? | |||||
Secret | ? | ? | |||||
Session | ? | ? | |||||
Settings | ? | ? | |||||
Trash | ? | ? | |||||
Wallpaper | ? | ? |
Configuration
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:
[preferred]
# Use xdg-desktop-portal-gtk for every portal interface...
default=gtk
# ... except for the Screencast, Screenshot and Settings (dark/light mode) interface
org.freedesktop.impl.portal.Screencast=wlr
org.freedesktop.impl.portal.Screenshot=wlr
org.freedesktop.impl.portal.Settings=darkman
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.:
[portal]
DBusName=org.freedesktop.impl.portal.desktop.gnome
Interfaces=org.freedesktop.impl.portal.Account;org.freedesktop.impl.portal.AppChooser;org.freedesktop.impl.portal.Screenshot;org.freedesktop.impl.portal.ScreenCast;org.freedesktop.impl.portal.RemoteDesktop;org.freedesktop.impl.portal.Lockdown;org.freedesktop.impl.portal.Background;org.freedesktop.impl.portal.Settings;org.freedesktop.impl.portal.Wallpaper;org.freedesktop.impl.portal.FileChooser;org.freedesktop.impl.portal.Print;org.freedesktop.impl.portal.DynamicLauncher;
UseIn=gnome;sway;
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.Usage
xdg-desktop-portal is usually not called manually; instead, 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
- The xdg-desktop-portal project page
- The portals.conf(5) man page