File Chooser does not open for Flatpak Applications | F40 | Sway

Hello,

I’m on a mostly fresh install of Fedora Sway 40, and whenever I hit a button that should result in the file chooser opening up (like I try to Download something in Ungoogled Chromium or set my library in Steam), nothing happens. I’ve gotten stuck trying to look at fixes and debug it myself, so I was wondering if I could get some help.


system information

OS: Fedora Linux 40 (Sway) x86_64 
Kernel: 6.9.9-200.fc40.x86_64

xdg portal package information

Name         : xdg-desktop-portal-wlr
Version      : 0.7.1
Release      : 1.fc40
Architecture : x86_64
Size         : 111 k
Source       : xdg-desktop-portal-wlr-0.7.1-1.fc40.src.rpm
Repository   : @System
From repo    : anaconda

Name         : xdg-desktop-portal
Version      : 1.18.4
Release      : 1.fc40
Architecture : i686
Size         : 488 k
Source       : xdg-desktop-portal-1.18.4-1.fc40.src.rpm
Repository   : updates
Summary      : Portal frontend service to flatpak
URL          : https://github.com/flatpak/xdg-desktop-portal/

Name         : xdg-desktop-portal
Version      : 1.18.4
Release      : 1.fc40
Architecture : x86_64
Size         : 2.3 M
Source       : xdg-desktop-portal-1.18.4-1.fc40.src.rpm
Repository   : @System
From repo    : updates
Summary      : Portal frontend service to flatpak
URL          : https://github.com/flatpak/xdg-desktop-portal/

The last thing I tried to do to fix this was to reinstall Fedora Sway spin while keeping my home directory, but nothing got fixed. On my last install I was trying to get my gtk and qt6 themes to work together with kvantum, and it may be possible along the way that I deleted something important in the ~/home/username directory. (I recall deleting ~/.local/gtk-2.0 and ~/.local/gtk-3.0.

I also have the following files in /usr/share/xdg-desktop-portal:


/usr/share/xdg-desktop-portal/sway-portals

[preferred]
# Use xdg-desktop-portal-gtk for every portal interface...
default=gtk
# ... except for the ScreenCast, Screenshot and Secret
org.freedesktop.impl.portal.ScreenCast=wlr
org.freedesktop.impl.portal.Screenshot=wlr
org.freedesktop.impl.portal.Secret=gnome-keyring

/usr/share/xdg-desktop-portal/wlroots-portals

[preferred]
# Use xdg-desktop-portal-gtk for every portal interface...
default=gtk
# ... except for the ScreenCast and Screenshot
org.freedesktop.impl.portal.ScreenCast=wlr
org.freedesktop.impl.portal.Screenshot=wlr

/usr/share/xdg-desktop-portal/portals/gnome-keyring.portal

[portal]
DBusName=org.freedesktop.secrets
Interfaces=org.freedesktop.impl.portal.Secret
UseIn=gnome

/usr/share/xdg-desktop-portal/portals/gtk.portal

[portal]
DBusName=org.freedesktop.impl.portal.desktop.gtk
Interfaces=org.freedesktop.impl.portal.FileChooser;org.freedesktop.impl.portal.AppChooser;org.freedesktop.impl.portal.Print;org.freedesktop.impl.portal.Notification;org.freedesktop.impl.portal.Inhibit;org.freedesktop.impl.portal.Access;org.freedesktop.impl.portal.Account;org.freedesktop.impl.portal.Email;org.freedesktop.impl.portal.DynamicLauncher;org.freedesktop.impl.portal.Settings;
UseIn=gnome

/usr/share/xdg-desktop-portal/portals/wlr.portal

[portal]
DBusName=org.freedesktop.impl.portal.desktop.wlr
Interfaces=org.freedesktop.impl.portal.Screenshot;org.freedesktop.impl.portal.ScreenCast;
UseIn=wlroots;sway;Wayfire;river;phosh;Hyprland;

Any debugging tips or hints for where I should look next would be much appreciated. Thanks.

Removed gnome, installation

Welcome to :fedora:

In the case you do not get timely responses here, You can find some help on Sway on these support channels.

Support chat for Sway WM

https://web.libera.chat/gamja/?channels=#sway

File a bug, issue tracker

Solved here.

The fundamental issue is that if you don’t run a login manager, then when you log in, systemd will start the xdg-desktop-portal-gtk service which relies on having a display server running, but the display server will only run after calling sway post-login.

Therefore, xdg-desktop-portal-gtk (which picks the file chooser) will crash.
The bandaid solution is to place exec /usr/libexec/xdg-desktop-portal-gtk at the bottom of the sway config file, which will run the file chooser daemon upon starting the display server.

But ideally, either xdg-desktop-portal-gtk should never be called before the display server starts or run and handle the situation when no display server is running yet.

Added portals

Very niche, but thanks for the update !