When using the Sway window manager, the file chooser dialog does not always open

Problem

Particularly with Google Chrome (but the problem might not be exclusive to that program), clicking things that should open the file chooser dialog box seem to do nothing. Examples include clicking the attach file button ( :paperclip:) in gMail or trying to attach an image when composing an issue report in GitLab. This problem also happens when right-clicking on an image in a web page and selecting ā€œSave image asā€¦ā€.

Cause

According to Joe P., ā€œfor xdg-desktop-portal-gtk (amongst others) to show the file picker, systemd needs to have a (default) DISPLAY env variable in its own systemd environmentā€ (bugzilla.redhat.com ā€“ BZ#2241173 ā€“ Comment 5).

Related Issues

Workarounds

Add the below line to your ~/.config/sway/config. You should probably put the following line near the end of your configuration, but before you start launching any other programs with exec ... lines.

exec systemctl --user import-environment DISPLAY

Thanks for the write-up. Looking at the bug reports, people complained last year, but no-one complained this year. Is the bug still present, even on currently supported Fedora versions (Iā€™m mostly interested about Fedora 40)?

Also, it seems that this doesnā€™t affect Fedora Sway (standard/atomic) spin users by default, only if you mix and match environments and xdg-desktop-portal-gtk gets installed? Can you verify and include it in your description?

Lastly, in order to have this bug fixed, it needs to be reported upstream (either xdg-desktop-portal-gtk or sway, not sure what is better), but I see no link to such a report. Can you create this report and update Bugzilla and this topic with that upstream ticket? Thanks.

The sway-systemd package has this and some other features (like cgroup support), and Fedora Sway spin includes it by default.

2 Likes

Ah, so that is what I was missing. IIRC, I installed Sway using something along the lines of dnf group install "Sway Desktop". If my installation method is unusual enough to disqualify this as a common issue, I understand. Thanks!

If the problem is that the dependency is missing from one of the dnf package groups, Iā€™m guessing that isnā€™t an ā€œupstreamā€ bug?

sway-systemd is a weak dependency of the sway-config-fedora package, which is installed when you run dnf group install "Sway Desktop". If you have weak dependencies installed, you should have it. Also, if you have a user configuration file in your home directory, you need to put include /etc/sway/config.d/* in it.

That explains it. I have install_weak_deps=0 in /etc/dnf/dnf.conf. I think there might be a case to be made that sway-systemd should be a hard dependency. But Iā€™ll leave that to you and withdraw this ā€œcommon issueā€ report since Iā€™ve clearly deviated from the norm more than I realized. Thanks for the detailed explanation.

Edit: I was also missing include /etc/sway/config.d/* in my ~/.config/sway/config. But that is my mistake as well. The config Iā€™m using was carried over from an earlier i3 installation and modified. Thanks again for pointing that out.

1 Like

based on the comment from @glb this is being moved to ā€˜ask fedoraā€™

2 Likes

From Proposed Common Issues to Ask Fedora

Thanks a lot, @ersen! Iā€™m glad this got sorted out. I updated the bugzilla with some hints, if anyone wants to make the experience better for ā€œnon-weak-deppersā€ :wink:

2 Likes