OVERHEAD

GTK4 dark mode and file-picker fix for XFCE flatpaks

Linux

Assumptions

  1. You’re using XFCE, or some other GTK desktop environment which isn’t GNOME.
  2. You’ve already installed xdg-desktop-portal and xdg-desktop-portal-gtk (xdg-desktop-portal-xapp isn’t necessary for the file-picker to be shown).
  3. But despite this, the file-picker in various apps isn’t showing up, and dark mode isn’t being respected for GTK4 apps.

The fix

Create a file at $XDG_CONFIG_HOME/xdg-desktop-portal/portals.conf, and give it the following content:

XDG Desktop Portal user config which sets the default portal & file-picker handler to the value of “gtk”.

[preferred]
default=gtk
org.freedesktop.portal.OpenURI.OpenURI=gtk

This fix is necessary because the configs under /usr/share/xdg-desktop-portal/ only check for the GNOME desktop environment, so other GTK environments like XFCE will be ignored. See this xdg-desktop-portal pull request for more information (this is the patch that introduced the config override described in this post).