Introduction to Mir’s Wayland platform
If you’ve been following closely, you’ll know that Mir has multiple backends (or platforms) for running on different graphics stacks. The two most commonly used are “gbm-kms” (for Mesa and other drivers supporting GBM) and “x11” (for running as a window on a desktop). But there is another, “wayland” for running on another Wayland compositor.
Mir’s Wayland platform derives from the work on Unity8 (since renamed Lomiri by the UBports community). There, the hardware was controlled by one “system compositor” and user sessions ran on top of that (with no direct access to the hardware). Because of this history, the Wayland platform simply opens a fullscreen window on each of the outputs and has no “windowed” mode. That makes it less useful for desktop testing than the “x11” backend.
But it is possible to use on a Wayland desktop and that’s what I’ll describe here. Specifically, using it on GNOME/Wayland.
Installing a Mir compositor (egmde)
Egmde is available as a snap. This is convenient for this post, but you can build egmde from source if you wish to, or use a different Mir compositor from the
mir-demos deb package.
To install egmde is as simple as:
sudo snap install egmde --classic
That installs egmde, but if you try running
egmde you’ll see that it starts up in a “Mir on X” window indicating it uses the “x11” platform.
Running using the Wayland platform
The trick is to enable the “wayland” platform with the following command line:
egmde --wayland-host $WAYLAND_DISPLAY
That tells Mir that you want it to use your desktop session as a Wayland “host”.
As mentioned above, Mir will open a fullscreen window for each of your outputs. But, for some reason, GNOME ignores the output being requested and opens them all on the primary display. (I’ve yet to investigate whether this is intended or a bug.) You can move the windows onto the correct outputs using
Using the nested desktop
GNOME isn’t expecting to be running a “desktop” as an application and Wayland “doesn’t do grabs”, so there are some keystrokes that GNOME intercepts before they arrive at Mir: For example,
Alt-Tab doesn’t switch windows on the egmde “desktop” but switches away from Mir. This can be confusing.
Because of this egmde has some alternative shortcuts (e.g.
Ctrl-Alt-] will switch apps) that make it usable, if not convenient, when hosted by GNOME.
It can also be useful to avoid applications run through egmde connecting to the user DBus session as this can confuse some applications. For this the command to start egmde becomes:
dbus-run-session egmde --wayland-host $WAYLAND_DISPLAY
Running a Mir compositor using the Wayland backend works well enough to prove the Wayland backend. However, using it when hosted by another compositor that doesn’t expect it leaves a lot to be desired.
You can run Mir servers hosted by egmde (including egmde itself) as there’s an option to turn off all the keyboard shortcuts and pass them through to the current application. (
Ctrl+Alt+Del toggles this setting.)