Slow application startup

I guess it’s a problem of xdg-desktop-portal-gtk. I encounter with the same problem on niri (a wayland compositor) today. Some applications is so slow and more than 25s to startup, such as Nautilus and Clash-Verge.

I ask Gemini and find that my xdg-desktop-portal-gtk.service can not start correctly,

❯ systemctl --user status xdg-desktop-portal-gtk
 ○ xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation)
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal-gtk.service; linked-runtime; preset:>
     Active: inactive (dead) 

because I use cmd niri(simply a command to bare run niri) to login in, instead of niri-session(a more complete environment initialization script).

And further I investigate journalctl,

❯ journalctl -f --user -u xdg-desktop-portal
 Jan 31 23:10:02 kitty systemd[1365]: Starting Portal service (GTK/GNOME implementation)...
Jan 31 23:10:02 kitty xdg-desktop-portal-gtk[35784]: cannot open display:

which agrees with the problem above.

On Niri, using niri-session instead of just niri fixes this. It passes important information (like the screen ID) to the system. Without this, the portal service gets lost and waits for 25s, making apps feel stuck.

Unfortunately, I don’t know how to solve the problem on other desktop. The only thing I know is that background services must be told where the screen is.

1 Like

The generic solution to your problem is uwsm, though for niri you should probably indeed use their native solution.

Using UWSM (correctly, read its readme) will also fix a bunch of other problems. It’s quite likely a lot of people in this thread were just not setting up their environment correctly, but in fairness, it’s very old.

There are likely other causes of these symptoms, though, as you can see further up.

2 Likes

Thx! I’ll try it when I use other WM in the future.