Bug 473729 - xdg-desktop-portal-kde causes slow launch times on other desktops like GNOME
Summary: xdg-desktop-portal-kde causes slow launch times on other desktops like GNOME
Status: RESOLVED UPSTREAM
Alias: None
Product: xdg-desktop-portal-kde
Classification: Plasma
Component: general (show other bugs)
Version: 5.27.7
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-24 16:04 UTC by superm1000
Modified: 2023-08-25 06:41 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description superm1000 2023-08-24 16:04:20 UTC
SUMMARY
When Plasma is installed, desktop environments that aren't Plasma exhibit delays due to xdg-desktop-portal-kde

STEPS TO REPRODUCE
1. Install GNOME and KDE Plasma at the same time.
2. Log into a GNOME session
3. Launch Firefox (installed from RPM)

OBSERVED RESULT
Firefox takes about 20 to 30 seconds to start, since xdg-desktop-portal waits for xdg-desktop-portal-kde until its timeout is reached. This only happens once per session. After the first time, Firefox starts immediately. The issue reoccurs after logging out and logging back in again.

EXPECTED RESULT
xdg-desktop-portal-kde recognizes that it's not in a Plasma session and exits (or does whatever it needs to do to not hold up xdg-desktop-portal). Firefox starts immediately.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 38
KDE Plasma Version: Plasma 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
In the moment in which I click on Firefox for the first time in a session, the following output appears in journalctl --user --unit plasma-xdg-desktop-portal-kde.service :

Aug 24 17:36:07 maximaschine xdg-desktop-portal-kde[16704]: QSocketNotifier: Can only be used with threads started with QThread


In the moment in which Firefox actually starts, the following output appears in journalctl --user --unit xdg-desktop-portal.service :


Aug 24 17:36:32 maximaschine xdg-desktop-por[16427]: Failed to create settings proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.kde: Timeout was reached


The plasma-xdg-desktop-portal-kde.service unit is considered "running" by systemd after this, though. It just doesn't seem to provide the interfaces it needs to.

I also came across this issue previously in a Hyprland session on Arch on a different machine, so this isn't specific to GNOME, Fedora or this computer.

The issue can be worked around by running systemctl --user mask plasma-xdg-desktop-portal-kde.service although this will obviously leave the Plasma install in a somewhat broken state.

GNOME actually seems to have had a similar issue in the past [1] but according to the linked thread this was fixed. 

[1] https://github.com/flatpak/xdg-desktop-portal/issues/998
Comment 1 David Redondo 2023-08-25 06:41:30 UTC
This has been solved upstream with https://github.com/flatpak/xdg-desktop-portal/blob/main/doc/portals-conf.rst now DE and users can fine grainly configure which portal backends are started. By default in GNOME for example only gnome, on Plasma only the KDE portal.