Fix apps taking 20 seconds to open and file pickers never appearing
Symptom
Apps take 15-25 seconds to open after login, file pickers hang or never appear, and screen sharing does not work, but everything is fine if you restart the app later. Sometimes accompanied by multiple xdg-desktop-portal implementations running.
Cause
Portals and systemd user services are started before Hyprland has exported WAYLAND_DISPLAY and XDG_CURRENT_DESKTOP into the D-Bus/systemd activation environment, so xdg-desktop-portal picks the wrong backend or blocks waiting for one, and every portal call waits out its timeout.
Fix
Export the environment on Hyprland start, before anything that needs a portal.
Lua (0.55+):
hl.on("hyprland.start", function()
hl.exec_cmd("dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE")
end)
hyprlang:
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE
If portals still launch too early, restart them after a delay. This is the FAQ's own workaround:
#!/usr/bin/env bash
sleep 4
killall -e xdg-desktop-portal-hyprland
killall xdg-desktop-portal
/usr/lib/xdg-desktop-portal-hyprland &
sleep 4
/usr/lib/xdg-desktop-portal &
Save as ~/.local/bin/fix-portals.sh, chmod +x, and run it from autostart.
Check for competing implementations:
pacman -Qs xdg-desktop-portal
systemctl --user status 'xdg-desktop-portal*'
systemctl --user show-environment | grep -E 'WAYLAND_DISPLAY|XDG_CURRENT_DESKTOP'
Remove portal backends you do not use (e.g. xdg-desktop-portal-gnome on a Hyprland-only box).
Verify
systemctl --user show-environment lists WAYLAND_DISPLAY and XDG_CURRENT_DESKTOP=Hyprland. A GTK file dialog opens instantly.