I don't really like doing the sd_pid_get_user_unit
thing in both places. A new MetaDisplayPolicy
could work, but that requires more changes all over the place.
The (gnome-shell) handling to start the X11 related services (i.e. gsd-xsettings) requires running in a systemd managed session. If this is not the case, we must start Xwayland already for gsd-xsettings and we cannot auto-shutdown Xwayland.
As such, we get three common cases:
- Fully working Xwayland on demand on systemd
- gsd-xsettings starting Xwayland immediately at login time (this is currently the case for the gnome-initial-setup session)
- Xwayland remaining dormand as nothing ever requires it (this is the case for the GDM greeter)