Bug 2241173 - File chooser dialog is not showing with sway
Summary: File chooser dialog is not showing with sway
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: xdg-desktop-portal
Version: 38
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: David King
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-09-28 11:58 UTC by benjgentil
Modified: 2024-01-30 19:36 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description benjgentil 2023-09-28 11:58:56 UTC
When I try to open/save a file from various applications (vivaldi, chromium, slack...) nothing happens

Reproducible: Always

Steps to Reproduce:
1.Install fedora 38
2.Install sway, vivaldi, chromium from packages or slack from flatpak
3.Try to open a file chooser dialog
Actual Results:  
Nothing happens

Expected Results:  
A file chooser dialog should be opened

From what I understand it should be handled by a `org.freedesktop.impl.portal.FileChooser` interface provided by gtk.

If I set `UseIn` to `gnome;sway` instead of `gnome` in /usr/share/xdg-desktop-portal/portals/gtk.portal, everything works as expected.

Comment 1 Fabio Alessandro Locati 2023-09-28 12:30:38 UTC
When you say "install sway", what exactly do you mean? Which package are you installing?

Also, please, provide the output of `rpm -qa|grep sway`.

The file /usr/share/xdg-desktop-portal/portals/gtk.portal is owned by xdg-desktop-portal-gtk, so if the correct solution is the one you are suggesting, a bug against xdg-desktop-portal-gtk should be opened.

Thanks

Comment 2 benjgentil 2023-09-28 13:19:57 UTC
Thank you for the fast response!

I installed sway quite a while ago so to be honest I don't remember the exact packages I installed, I just know that I have `sudo dnf install sway` in my shell history and my current packages are:
```
swaylock-1.7.2-1.fc38.x86_64
swayidle-1.8.0-2.fc38.x86_64
swaybg-1.2.0-2.fc38.x86_64
sway-wallpapers-1.8.1-1.fc38.noarch
sway-1.8.1-1.fc38.x86_64
sway-config-upstream-1.8.1-1.fc38.noarch
sway-systemd-0.4.0-1.fc38.noarch
```

I filed the bug against sway because the issue is sway-specific and I don't know how those dialogs should be displayed when using sway, maybe xdg-desktop-portal shouldn't be used with sway, I wish I could select multiple components in the bug tracker as it is more of an interface issue between 2 components rather than a bug on a single one.

Comment 3 Aleksei Bavshin 2023-09-29 02:41:35 UTC
Lovely. And 100% reproducible - just take up-to-date F38 Sway spin installation and add `xdg-desktop-portal-gnome`.

`xdg-desktop-portal` picks `xdg-desktop-portal-gnome` for all the portals provided by the backend. Completely ignoring the fact that GNOME portal backend is running in a degraded Settings-only mode and refuses to serve any other impls.
It should be fixed with `xdg-desktop-portal-1.18.0` and new `portals.conf` configuration, but we don't have that in Fedora 38 :(

> If I set `UseIn` to `gnome;sway` instead of `gnome` in /usr/share/xdg-desktop-portal/portals/gtk.portal, everything works as expected.

Yep. That seems to work, because it goes straight to the -gtk backend instead of checking all available implementations in alphabetic order.
Doesn't really help on Silverblue with layered Sway (/usr is readonly), but `Environment=XDG_DESKTOP_PORTAL_DIR=%h/.config/xdg-desktop-portal/portals` in the systemd unit override may solve that.

Anyways, the bug goes to the rightful owner at `xdg-desktop-portal`.

```
systemd[890]: Starting xdg-desktop-portal-gnome.service - Portal service (GNOME implementation)...
xdg-desktop-portal-gnome[11157]: Non-compatible display server, exposing settings only.
systemd[890]: Started xdg-desktop-portal-gnome.service - Portal service (GNOME implementation).
...
xdg-desktop-portal[11131]: XDP: load portals from /usr/share/xdg-desktop-portal/portals
systemd[890]: Starting xdg-desktop-portal.service - Portal service...
xdg-desktop-portal[11131]: XDP: loading /usr/share/xdg-desktop-portal/portals/wlr.portal
xdg-desktop-portal[11131]: XDP: portal implementation for wlroots, sway, Wayfire, river, phosh, Hyprland
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Screenshot
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.ScreenCast
xdg-desktop-portal[11131]: XDP: loading /usr/share/xdg-desktop-portal/portals/gnome.portal
xdg-desktop-portal[11131]: XDP: portal implementation for gnome
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Account
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.AppChooser
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Screenshot
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.ScreenCast
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.RemoteDesktop
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Lockdown
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Background
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Settings
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Wallpaper
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.FileChooser
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Print
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.DynamicLauncher
xdg-desktop-portal[11131]: XDP: loading /usr/share/xdg-desktop-portal/portals/gtk.portal
xdg-desktop-portal[11131]: XDP: portal implementation for gnome
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.FileChooser
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.AppChooser
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Print
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Notification
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Inhibit
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Access
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Account
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Email
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.DynamicLauncher
xdg-desktop-portal[11131]: XDP: portal implementation supports org.freedesktop.impl.portal.Settings
xdg-desktop-portal[11131]: XDP: Creating dummy proxy for org.freedesktop.impl.portal.Lockdown on org.freedesktop.impl.portal.desktop.gnome
xdg-desktop-portal[11131]: XDP: Dummy proxy created
xdg-desktop-portal[11131]: XDP: Falling back to gnome.portal for org.freedesktop.impl.portal.Lockdown
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.MemoryMonitor
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.PowerProfileMonitor
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.NetworkMonitor
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.ProxyResolver
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.Trash
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.GameMode
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.Realtime
xdg-desktop-portal[11131]: XDP: Using gnome.portal for org.freedesktop.impl.portal.Settings
xdg-desktop-portal[11131]: XDP: Using gtk.portal for org.freedesktop.impl.portal.Settings
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.Settings
xdg-desktop-portal[11131]: XDP: Creating dummy proxy for org.freedesktop.impl.portal.FileChooser on org.freedesktop.impl.portal.desktop.gnome
xdg-desktop-portal[11131]: XDP: Dummy proxy created
xdg-desktop-portal[11131]: XDP: Falling back to gnome.portal for org.freedesktop.impl.portal.FileChooser                                       <= this.
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.FileChooser
xdg-desktop-portal[11131]: XDP: Creating dummy proxy for org.freedesktop.impl.portal.AppChooser on org.freedesktop.impl.portal.desktop.gnome
xdg-desktop-portal[11131]: XDP: Dummy proxy created
xdg-desktop-portal[11131]: XDP: Falling back to gnome.portal for org.freedesktop.impl.portal.AppChooser
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.OpenURI
xdg-desktop-portal[11131]: XDP: Creating dummy proxy for org.freedesktop.impl.portal.Print on org.freedesktop.impl.portal.desktop.gnome
xdg-desktop-portal[11131]: XDP: Dummy proxy created
xdg-desktop-portal[11131]: XDP: Falling back to gnome.portal for org.freedesktop.impl.portal.Print
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.Print
xdg-desktop-portal[11131]: XDP: Creating dummy proxy for org.freedesktop.impl.portal.Notification on org.freedesktop.impl.portal.desktop.gtk
xdg-desktop-portal[11131]: XDP: Dummy proxy created
xdg-desktop-portal[11131]: XDP: Falling back to gtk.portal for org.freedesktop.impl.portal.Notification
xdg-desktop-portal[11131]: XDP: providing portal org.freedesktop.portal.Notification
```

Comment 4 sorje 2023-11-28 01:10:51 UTC
after upgrading to fedora 39 i ran into the same bug, i am using Enlightenment.

```
enlightenment-data-0.25.4-3.fc39.noarch
enlightenment-0.25.4-3.fc39.x86_64
```

ctrl+o in brave-browser / firefox does not work.

workaround with adding enlightenment to UseIn in file /usr/share/xdg-desktop-portal/portals/gtk.portal does not seem to work.

I fixed by creating /usr/libexec/xdg-desktop-portal as personal application launcher and adding it to startup applications, that way it's started with enlightenment environment.

i am unable to remove xdg-desktop-portal-gnome as it's used by gnome-shell which protected.

```
Problem: The operation would result in removing the following protected packages: gnome-shell
```

thanks for helping out.

Comment 5 jhmj 2023-12-17 16:03:00 UTC
for xdg-desktop-portal-gtk (amongst others) to show the file picker systemd needs to have a (default) DISPLAY env variable in it's own systemd environment

this default behaviour no longer exists?!


fix therefor:
make sure DISPLAY=:0 in the (sway) user environment
to check: env | grep DISPLAY

then import this in the --user environment of systemd

systemctl --user import-environment DISPLAY


Note You need to log in before you can comment on or make changes to this bug.