sway: Slow launch for (some) GTK apps
-
Sway Version:
sway version 1.5-d6ac3075 (Oct 13 2020, branch 'master')
-
Debug Log: https://gist.github.com/tokyovigilante/198fe1b11f378bc02b9c41b14396cf18
-
Configuration File: Minimal - https://gist.github.com/tokyovigilante/1222534c8743c1827933fe4d3cbd6d38
-
Description: Launching some GTK/GLib apps seems to hang for ~10-15 sec before launching and running normally. Occurs at least with waybar, sublime-merge and Pantheon files app. Doesn’t happen with Vivaldi, ST3 or terminal (alacritty). Nothing obvious in the log, all affected apps should be Wayland-native. 100% reproducible with affected apps.
Log shows launch to minimal desktop, followed by waybar appearing at ~15 sec as a result of being called from bar_command.
Lenovo X1Y4 with FC33, Kernel 5.9 and mesa-git, although also occuring on an Intel desktop with AMD GPU (also using mesa-git).
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 15
- Comments: 22 (9 by maintainers)
Links to this issue
Commits related to this issue
- sway: Source system configurations Fixes https://github.com/swaywm/sway/issues/5732 — committed to nichobi/dotfiles by nichobi 3 years ago
- fix: add include to sway config file - https://github.com/swaywm/sway/issues/5732 — committed to pviotti/dotfiles by pviotti a year ago
This might be related to the switch from
wayland-0towayland-1? I solved something like this by putting a *.conf file in~/.config/environment.dcontainingWAYLAND_DISPLAY=wayland-1.Edit: try
systemctl --user status xdg-desktop-portal.service. If that service failed with an error relating to the Wayland display, then that’s you’re problem. Specifically, GTK is trying to use the service here and it’s failing, with a long timeout.Heard on IRC that adding
exec systemctl --user import-environmentto the config file helped with that for some reason…Adding
exec systemctl --user import-environmentto my config and restarting fixed this issue for me as wellNot using sway, but ran into similar issue, as opposed to Michael, I didn’t have to get rid of all
xdg-desktop-portalpackages, only had to get rid ofxdg-desktop-portal-gnome, which fixed the issue.Same for me and adding
exec systemctl --user import-environmentnot fix. But removingxdg-desktop-portal-gnomefix it ! I don’t use sandboxed app.I had the same issue. I tried everything in the wiki and the recommendations from this issue. Unfortunately, nothing helped besides removing
xdg-desktop-portal.Later on, I figured out that I had some other portal backends installed like
xdg-desktop-portal-gtk. After I removed every package that started withxdg-desktop-portal-andxdg-desktop-portalI installedxdg-desktop-portal-wlragain, which installedxdg-desktop-portalas dependency, everything worked. Besides that, I only haveinclude /etc/sway/config.d/*in my sway config, which currently includes the file/etc/sway/config.d/50-systemd-user.confcontaining the following two lines.I’m uncertain if the file is available on every distribution, so check that first, i.e., using
cat /etc/sway/config.d/*which should print them. If not, just put them in your sway config instead of theinclude ...line.@wmww Sure looks that way:
Neither adding the environment variable, nor
exec systemctl --user import-environmenthave seemed to help however.Here’s a strace log from launching
pavucontrol, noting the jump from 15:22:42 -> 15:22:57 and then to 15:23:07.https://gist.github.com/tokyovigilante/872e9e24c061886ab19a14f9ae19ad3c
Note that because some distributions ship by default a similar script for X11, that explains why we’re the only ones seeing this.
https://github.com/systemd/systemd/blob/dfc637d0ff756889e8e5b7cb4ec991eb06069aa1/xorg/50-systemd-user.sh
Some systemd distributions like Arch Linux ship something similar by default:
https://github.com/archlinux/svntogit-community/blob/a334964ae6210e6dcbe5db094d51d7c27e6f89b0/trunk/50-systemd-user.conf
Obviously it’s not included by default in user config files.
I don’t think there’s much to be done here. I added a wiki entry to document the issue: https://github.com/swaywm/sway/wiki#gtk-applications-take-20-seconds-to-start
xdg-desktop-portal-gnomewas the culprit for me as well.This was still an issue for my system, and will probably be for others. Mostly default Ubuntu 22.04.1 LTS with Sway installed, fixed with
exec systemctl --user import-environmentin my config. Sway version 1.7FWIW the very end in my sway file runs
exec "systemctl --user import-environment SWAYSOCK WAYLAND_DISPLAY;to ensure that my units see the correct$WAYLAND_DISPLAY. However this obviously breaks multi session logins of the same user, since my systemd user units will only ever work with the last started sway compositor.Was going to edit the above post, but thanks for the speedy reply. Mysteriously fixed after a reboot with both fixes above applied. Are these true fixes and I can close this, or is there an underlying sway bug?
I’m on Hyprland, was having the same issues and fixed them by following their wiki, however, some GTK apps were still having the 25s timeout (Firefox and Virt-Manager, for me), even with
GTK_USE_PORTAL=0, and I couldn’t get much relevant information from journalctl, but thankfully I ran into this blog post, and gnome-keyring-daemon was the root cause of my secondary issue.