emersion / xdg-desktop-portal-wlr

xdg-desktop-portal backend for wlroots
MIT License
580 stars 54 forks source link

contrib/systemd: remove unnecessary `After=` directive #238

Closed ngkz closed 6 months ago

ngkz commented 1 year ago

After=graphical-session.target causes a dependency loop.

If there are user services that depend on the portal and start before graphical-session.target, graphical-session.target waits for the service, the service waits for xdg-desktop-portal, xdg-desktop-portal waits for xdg-desktop-portal-wlr, and then xdg-desktop-portal-wlr waits for graphical-session.target.

The service and the portal stuck until xdg-desktop-portal-wlr activation timeout (25s).

The compositor must be initialized before GUI apps therefore this directive is not needed.

ngkz commented 1 year ago

I mean, graphical-session.target gets started after the compositor therefore xdg-desktop-portal-wlr does not need to wait for anything

emersion commented 1 year ago

Maybe we should replace that with graphical-session-pre.target?

We use ConditionEnvironment, which is known to not work correctly. I think with that patch systemd would only check the ConditionEnvironment once, never trying to start xdpw again once the Wayland compositor is up. More details here: https://github.com/emersion/mako/commit/6c955b74a74a3eb7eed6566ddcec125bc3a55c8c

BTW, mako has this After key and seems to work correctly, so not sure what's up here.

emersion commented 6 months ago

Closing, please re-open if you believe this should be discussed further.