GTK Apps slow to launch due to dbus error.
Technically I have already resolved this issue, but I wanted to verify whether my solution was the ideal one and see if documentation should be updated accordingly.
I've been having trouble with certain GTK-based applications launching very slowly (~30-60 seconds) under river. Culprits included wofi, wdisplays, and nautilus to name a few. Wofi outputs the following in the terminal just before launching:
(wofi:10815): Gdk-WARNING **: 16:46:41.456: Settings portal not found: Error calling StartServiceByName for org.freedesktop.portal.Desktop: Timeout was reached
The solution in my case was to install xdg-desktop-portal-wlr add the following to my init script based on similar instructions for sway from the xdg-desktop-portal-wlr github page:
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river
This has largely resolved the slow launching issues I experienced, but I wasn't sure if this was an issue anyone else has encountered, or whether this is the ideal way to go about resolving the problem. If this is the best solution, should xdg-desktop-portal-wlr be treated as a dependency, and the above be added to the example init script?
Hey! I'd consider this to be a GTK bug, 30-60 seconds is far too long for a timeout. I don't consider xdg-desktop-portal-wlr to be a dependency of river. If anything, one might consider it a dependency for GTK programs running on wayland.
Anyhow, your fix seems reasonable to me, see also the explanation of this issue on the sway wiki: https://github.com/swaywm/sway/wiki#gtk-applications-take-20-seconds-to-start
Thanks for the pointer. I was actually still having issues with slow first launches after a reboot, and adding systemctl --user import-environment to my init script further resolved that issue for me. Might at least be worth a note in the FAQ.