I believe the main problem is that WSLg is already running Weston, the Wayland reference server with its own window manager.
You can see this if you try to run just xfwm4
:
xfwm4-Message: 02:10:49.361: Another Window Manager (Weston WM) is already running on screen :0.0
xfwm4-Message: 02:10:49.361: To replace the current window manager, try "--replace"
(xfwm4:267): xfwm4-WARNING **: 02:10:49.361: Could not find a screen to manage, exiting
Attempting to --replace
does no good either, since Weston is actually running in a different distribution (the WSLg "System Distribution") and is just connected to your instance via sockets which are injected by /init
.
While I think I still prefer the xrdp
option, Wayland does provide its own X server for backward compatibility, so at least there's no need for a third-party, Windows-based X server like VcXsrv as there was on Windows 10.
Install it via sudo apt install xwayland
.
At this point, I'm sure there's a better way of doing things, but here's what I've come up with so far:
Xwayland :1 &
WAYLAND_DISPLAY= DISPLAY=:1 xfce4-session
You should get an Xfce4 desktop running on Xwayland.
Note that WAYLAND_DISPLAY
needs to be unset or else Gtk apps will attempt to use the Wayland compositor first.
Also note that Ubuntu Desktop is a whole other story since it depends on Systemd.
What I'd still like to know, though, since I'm fairly new to Wayland on WSLg as well:
- Is there Xwayland support for
~/.Xsession
? (I couldn't make it work)
- Is there any other way to launch the session manager (or any client) when you launch Xwayland? There must be, since
Xwayland -help
shows a -terminate
option for shutting down when the last client closes.