Skip to content

Add side channel for services to startup on Xwayland session

At the gnome-shell hackfest, a way was devised so we can quasi-synchronously startup random additional services together right after starting Xwayland, so they are ensured to have an effect before any X11 client launched by the user. Examples where this might be needed are:

  • Loading of Xresource files
  • Starting up ibus-x11, so XIM users work
  • Setting up theme/scale/etc Xsettings, so there's no visual glitches

The way this would work is by:

  1. Setting up a -initfd socket to Xwayland
  2. Setting it up as an additional display through a gnome-specific envvar in the session (GNOME_SETUP_DISPLAY here)
  3. When starting Xwayland up, hook a MetaDisplay signal so that GNOME Shell may set up its additional services
  4. Have GNOME Shell launch gsd-xsettings there
  5. Have gsd-xsettings pick the gnome-specific envvar instead of DISPLAY
  6. Let gsd-xsettings run scripts from some specific locations ($XDG_CONFIG_DIRS/Xwayland-session.d/ here) before claiming its DBus name
  7. Have GNOME Shell find the name being claimed, and resume Xwayland startup.
  8. Have Mutter follow up on the dangling async task, and start the MetaX11Display on this private connection too.
  9. WM_S0 was just claimed, so Xwayland would now start handling the queued events in the regular -listen socket
  10. The launched app doesn't know what did just happen, but it will find a fully set up X11 session.

This MR implements steps 5. and 6. Admittedly, gsd-xsettings is a bit of a misnomer now, but it stands the only GNOME service inherently tied to X11. Perhaps it makes sense to use a more generic gsd-x11 name in the future, or somesuch...

Related MRs: mutter!945 (merged), gnome-shell!836 (merged)

Edited by Carlos Garnacho

Merge request reports