X11 vs Wayland: Choosing Your Display Server
What X11 and Wayland are, when to use each one, and how to switch between them on Ubuntu-based GNOME desktops.
What This Guide Achieves
Explain the difference between Wayland and X11 display servers, when to use each, and how to switch between them.
The Problem (Windows User Perspective)
On Windows, you never think about the “display server” — it’s invisible. On Linux, there are two competing display servers: Wayland (newer) and X11/Xorg (older but more compatible). Your choice affects which tools work and how some apps behave.
Which One Are You Using?
echo $XDG_SESSION_TYPE
x11→ You’re on X11 (Xorg)wayland→ You’re on Wayland
Wayland vs X11 — Quick Comparison
| Feature | X11 (Xorg) | Wayland |
|---|---|---|
| Age | ~40 years old | ~15 years old |
| Security | Less secure (any app can read any window) | More secure (strict app isolation) |
| Performance | Good | Better (less screen tearing) |
| HiDPI scaling | Basic | Better |
| Compatibility | Everything works | Some tools don’t work |
| Automation tools | wmctrl, xdotool, xclip all work | not always works |
| Screen sharing | Works everywhere | Some apps struggle |
When to Use X11 (Recommended for Most Users)
Use X11 if you:
- Use wmctrl, xdotool, or xclip for automation
- Run Stata or other apps that have Wayland bugs (window resizing issues)
- Need screen recording or screen sharing in apps like Zoom
- Use any tool that needs to control other windows programmatically
When to Use Wayland
Use Wayland if you:
- Want the latest security and performance improvements
- Don’t use any X11-specific automation tools
- Have a HiDPI display and want better scaling
How to Switch
At the Login Screen
- Log out of your current session
- On the login screen, click on your username
- Look for a gear icon (usually bottom-right corner)
- Select the X11/Xorg session if you need maximum compatibility. The exact label names vary by distro — look for an option containing “Xorg” in the session name (e.g. “Ubuntu on Xorg”).
- Enter your password and log in
Making It Permanent
The selection persists between reboots — whichever you chose last will be used on next login.
Known Issues with Wayland on the Tested Setup
| Issue | Description |
|---|---|
| Stata window resizing | GTK bug causes Stata GUI to not resize properly under Wayland |
| wmctrl/xdotool don’t work | These X11-only tools fail silently on Wayland |
| xclip doesn’t work | Clipboard automation requires X11 — use wl-clipboard on Wayland instead |
| Some Electron apps | Older Electron apps may have rendering issues |
Forcing an App to Use X11 on Wayland
If you’re on Wayland but need one specific app to use X11:
GDK_BACKEND=x11 stata-mp
Or add it permanently to the app’s .desktop file:
Exec=env GDK_BACKEND=x11 stata-mp
What Didn’t Work (and Why)
| Approach | Why It Failed |
|---|---|
| Using Wayland with wmctrl/xdotool automation scripts | These tools works properly on X11 — they fail silently on Wayland |
| Running Stata on Wayland | Window resizing GTK bug — must force X11 backend |
| Assuming all apps work on both | Some apps (especially older ones) only work properly on X11 |
Related Guides
- System Requirements — Why X11 was chosen for this setup
- Stata 19 Complete Guide — Wayland resize bug fix
- VS Code Setup — Automation tools that require X11
Discussion