====== Raspberry Pi: X11 or Wayland ======
With the operating system **Raspbian GNU/Linux 12 (bookworm)** it is possibile to choose between the traditional **X11** graphical backend and the new **Wayland**. With X11 you can use only the **Openbox** window manager, while in Wayland you can choose **Wayfire** or the **Labwc** window manager.
The default is **Wayland** + **Labwc** for all the Raspberry Pi models, including the Pi 2.
Start the **raspi-config** and navigate the **Advanced Options** => **Wayland** to make your choice.
If you are using the default **LightDM** desktop manager, the settings are saved into **/etc/lightdm/lightdm.conf**. Here are the entries for Wayland Wayfire, Labwc and X11 respectively:
=== Wayland Wayfire ===
greeter-session=pi-greeter-wayfire
user-session=LXDE-pi-wayfire
autologin-session=LXDE-pi-wayfire
fallback-test=/usr/bin/xfallback.sh
fallback-session=LXDE-pi-x
fallback-greeter=pi-greeter
=== Wayland Labwc ===
greeter-session=pi-greeter-labwc
user-session=LXDE-pi-labwc
autologin-session=LXDE-pi-labwc
#fallback-test=
#fallback-session=
#fallback-greeter=
=== X11 ===
greeter-session=pi-greeter
user-session=LXDE-pi-x
autologin-session=LXDE-pi-x
#fallback-test=
#fallback-session=
#fallback-greeter=
===== How to tell if X11 or Wayland is running =====
From a terminal running in the graphical environment:
set | grep XDG_SESSION
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=LXDE-pi-x
XDG_SESSION_ID=1
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=x11
the output for a Wayland Labwc session:
set | grep XDG_SESSION
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=LXDE-pi-labwc
XDG_SESSION_ID=1
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=wayland
You can also check the running processes:
ps uax | grep labwc
pi 786 3.3 7.6 287268 72252 ? Ss 11:00 0:11 /usr/bin/labwc -m
===== Wayland Wayfire not starting on the Raspberry Pi 2 =====
On the Raspberry Pi 2 the Wayland Wayfire does not start. Fortunately enough the ''raspi-config'' added into the **/etc/lightdm/lightdm.conf** configuration file the **fallback-session** option, which launches the legacy X11.
I discovered it because I installed the **hide-cursor** Wayfire plugin, but the plugin did not work. Actually the entire Wayfire was not running!
As per **Raspbian GNU/Linux 12 (bookworm)**, [[https://www.howtogeek.com/raspberry-pi-os-wayland-rollout/|Raspberry Pi OS Switches to Wayland on All Pi Models]], and [[https://hackaday.com/2024/10/28/raspberry-pi-oss-wayland-transition-completed-with-switch-to-labwc/|Raspberry Pi OS’s Wayland Transition Completed With Switch To Labwc]].
Wayfire is more resource-intensive than Labwc, so its use is discouraged and it will no start on the **Raspberry Pi 2**. Infact the **/usr/bin/xfallback.sh** script will return zero if run on the Pi 2.
===== Starting the Wayland backend manually =====
First of all you have to stop the running graphical environment. Stopping the LigthDM desktop manager will close the graphical screen on **VT#7**:
sudo systemctl stop lightdm.service
Then, as the unprivileged user, you can run the commad
wayfire-pi
or
labwc-pi
This can be useful to capture **stdout** and **stderr** messages from the window manager.