portals.conf(5)
π portals.conf(5) π β File Formats Manual
okay so bestie, this is the man page for portals.conf, and it's literally the vibe-check file that tells xdg-desktop-portal which portal backend is gonna show up to the party. it lives in the File Formats Manual section, and yes, we're gonna read the whole thing together, no skimming. π«Ά
β¨ Name β¨
portals.conf β XDG desktop portal configuration. that's it, that's the name, she's iconic. π
π SYNOPSIS π
so these are all the places this file can live, and honestly, it's giving "found in many homes":
$XDG_CONFIG_HOME/xdg-desktop-portal/{*-}portals.conf
$XDG_CONFIG_DIRS/xdg-desktop-portal/{*-}portals.conf
/etc/xdg/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
the {*-} is doing a lot of work there, but we'll get into that, don't worry. π
π¦ DESCRIPTION π¦
so like, xdg-desktop-portal reads a config file to figure out which portal backend should be used to provide the implementation for the requested interface. and this whole mechanism is very similar to the freedesktop.org spec for "Association between MIME types and applications" (mime-apps). iykyk.
desktop environments and OS vendors should provide a default configuration for their chosen portal backends in /usr/share/xdg-desktop-portal/DESKTOP-portals.conf, where DESKTOP is the desktop environment name as it would appear in the XDG_CURRENT_DESKTOP environment variable, after case-folding ASCII upper case to lower case. so for example, KDE should provide /usr/share/xdg-desktop-portal/kde-portals.conf. periodt.
users can override those defaults, or provide configuration for an otherwise unsupported desktop environment, by writing a file ~/.config/xdg-desktop-portal/portals.conf. and if you're a multi-desktop girlie, you can use desktop-specific filenames such as kde-portals.conf which will only be used in the appropriate desktop environment. π
similarly, system administrators can provide a default configuration for all users in /etc/xdg-desktop-portal/DESKTOP-portals.conf or /etc/xdg/xdg-desktop-portal/portals.conf. wait, no, bestie, let me reread β it's /etc/xdg-desktop-portal/DESKTOP-portals.conf or /etc/xdg-desktop-portal/portals.conf. slay.
the following locations are searched for configuration, highest precedence first:
$XDG_CONFIG_HOME, defaulting to~/.config- each directory in
$XDG_CONFIG_DIRS, defaulting to/etc/xdg - the build-time
sysconfdirforxdg-desktop-portal, usually/etc $XDG_DATA_HOME, defaulting to~/.local/share(searched only for consistency with other specifications, writing configuration here is not recommended)- each directory in
$XDG_DATA_DIRS, defaulting to/usr/local/share:/usr/share - the build-time
datadirforxdg-desktop-portal, usually/usr/share
in each of those locations, for each desktop environment name listed in the XDG_CURRENT_DESKTOP environment variable, xdg-desktop-portal checks for xdg-desktop-portal/DESKTOP-portals.conf, where DESKTOP is the desktop environment name in lower-case. if a desktop-environment-specific configuration file is not found, a non-desktop-specific file xdg-desktop-portal/portals.conf will be read. for example, if XDG_CURRENT_DESKTOP is set to Budgie:GNOME, then xdg-desktop-portal will look for xdg-desktop-portal/budgie-portals.conf, xdg-desktop-portal/gnome-portals.conf and xdg-desktop-portal/portals.conf in that order. the way that it just cascades down the listβ¦ obsessed. π
π FILE FORMAT π
the format of the portals configuration file is the same .ini format used by systemd unit files or application desktop files. we love a format crossover event.
[preferred]
the main configuration group for preferred portals. she's the main character group. π
the following keys can be present in the preferred group:
default(string) β the default portal backend to use for every interface, unless the interface is listed explicitly.org.freedesktop.impl.portal.*(string) β one of the valid portal interface implementations exposed byxdg-desktop-portal.
each key in the group contains a semi-colon separated list of portal backend implementation, to be searched for an implementation of the requested interface, in the same order as specified in the configuration file. and additionally, the special values none and * can be used:
noneβ do not provide a portal implementation for this interface. π*β use the first portal implementation found, in lexicographical order. β¨
π EXAMPLE π
[preferred]
# Use xdg-desktop-portal-gtk for every portal interface...
default=gtk
# ... except for the ScreenCast interface
org.freedesktop.impl.portal.ScreenCast=gnome
not the comments doing the narration for us π it's literally "gtk for everythingβ¦ except ScreenCast, that's gnome's job". iconic.
πΈ ENVIRONMENT πΈ
XDG_CURRENT_DESKTOPβ a colon-separated list of desktop environments, most specific first, used to choose a desktop-specific portal configuration. the default is an empty list.XDG_CONFIG_HOMEβ the per-userportals.conffile is located in this directory. the default is$HOME/.config.XDG_CONFIG_DIRSβ a colon-separated list of system configuration directories and secondary per-user configuration directories. the default is/etc/xdg.XDG_DATA_HOMEβ a per-user data directory, searched for consistency with other specifications. the default is$HOME/.local/share.XDG_DATA_DIRSβ a colon-separated list of system data directories and secondary per-user data directories. the default is/usr/local/share:/usr/share.
five env vars, five little queens, each one knowing exactly what she's about. π
π SEE ALSO π
- XDG Base Directory Specification β
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html - XDG Desktop Entry specification β
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html - XDG Association between MIME type and applications specification β
https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html
go read those too, bestie, they're the source material. no cap. πβ¨
and that's the whole page, fr fr. this was portals.conf(5) out of the File Formats Manual β that's the page you just read, and that's the section she belongs to. mwah, take care of your portal configs, and remember: highest precedence first, always. ππ¦π
π¦ where this page comes from
- fedora 44: xdg-desktop-portal 1.21.1-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: xdg-desktop-portal 1.21.1-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: xdg-desktop-portal 1.22.1-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: xdg-desktop-portal 1.22.1-1.fc44 Β· LGPL-2.1-or-later
- ubuntu resolute: xdg-desktop-portal 1.21.1+ds-1ubuntu3
- ubuntu resolute: xdg-desktop-portal 1.21.1+ds-1ubuntu3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms