Wayland is the modern display server on many Linux desktops, but some older or specialized applications still require X11. This guide shows you how to run those X11-only apps on a Wayland session, either through the built-in XWayland compatibility layer or by forcing the app to use X11 explicitly. You’ll learn the exact commands and settings needed, plus how to fix common issues.
What You’ll Need
- A Linux distribution running a Wayland session (GNOME, KDE Plasma, Sway, etc.)
- An X11-only application installed (e.g., some older games, proprietary tools, or apps that don’t support Wayland)
- Basic familiarity with the terminal
Step-by-Step
- Check your session type. Open a terminal and run
echo $XDG_SESSION_TYPE. If it printswayland, you’re in a Wayland session. If it printsx11, you’re already using X11 and don’t need this guide. - Try launching the app normally. Many X11 apps run automatically through XWayland, a compatibility layer that Wayland compositors include. Just launch the app from your application menu or terminal (e.g.,
myapp). If it opens, you’re done—it’s already using XWayland. - If the app doesn’t start, force X11 via environment variable. Some apps check for Wayland support and may try to use it, but fail. Set
GDK_BACKEND=x11for GTK apps orQT_QPA_PLATFORM=xcbfor Qt apps. For example:GDK_BACKEND=x11 myapporQT_QPA_PLATFORM=xcb myapp. - For Electron-based apps, add the
--disable-gpuflag if they crash, or setELECTRON_OZONE_PLATFORM_HINT=x11to force X11. - If the app still won’t run, check if XWayland is installed. On most distros, it’s installed by default, but you can verify with
which Xwayland. If missing, install it via your package manager (e.g.,sudo apt install xwaylandon Debian/Ubuntu). - Launch the app with explicit X11 display. If the app uses a specific display, run
DISPLAY=:0 myapp(or:1if that’s your XWayland display). Usually XWayland uses:0by default. - For full-screen games or apps with graphics issues, try running with
LIBGL_ALWAYS_SOFTWARE=1to force software rendering, which can fix black screens or crashes. - If the app needs root or special permissions, use
sudocarefully, but note that running GUI apps as root is generally discouraged. Instead, try to fix permission issues (e.g., for USB devices) via udev rules. - If you need to run multiple X11 apps with different settings, create a small shell script for each app with the necessary environment variables.
Common Mistakes
- Assuming all apps run under Wayland natively—most older apps don’t, and that’s fine.
- Forgetting to set the environment variable before launching the app; it must be in the same command or exported in the shell.
- Setting
GDK_BACKEND=x11for a Qt app—that won’t work; use the correct variable for the toolkit. - Using
DISPLAY=:0when your XWayland display is different. Check withecho $DISPLAYin a terminal where X11 apps work. - Killing XWayland to “fix� an issue—that will break all X11 apps.
Tips
- Use
env | grep -i waylandto see Wayland-related variables; some apps needWAYLAND_DISPLAYunset to force X11. - For persistent settings, add the environment variables to your shell profile (e.g.,
~/.bashrc) or to the app’s desktop file in~/.local/share/applications. - If an app has scaling issues, try setting
GDK_SCALE=2(for HiDPI) orQT_SCALE_FACTOR=2. - For games, consider using
gamescopeto run them in a nested Wayland session, which can improve compatibility. - Keep your system updated; XWayland improvements are frequent.
Troubleshooting
- App opens but shows a black window. Try software rendering:
LIBGL_ALWAYS_SOFTWARE=1 myapp. If that works, your GPU drivers may need updating. - App crashes immediately. Run it from the terminal to see error messages. Common fixes: install missing 32-bit libraries (if the app is 32-bit), or set
GDK_BACKEND=x11if it’s a GTK app. - App runs but has no sound. Check if PulseAudio or PipeWire is running. X11 apps may need
SDL_AUDIODRIVER=pulseaudioorALSAconfig. - Keyboard or mouse input doesn’t work. This is rare, but try setting
QT_X11_NO_MITSHM=1for Qt apps, or check your compositor’s input settings. - App is very slow. XWayland can be slower than native X11. Try disabling compositing in the app, or use
LIBGL_ALWAYS_INDIRECT=1for OpenGL apps (though this may break some). - Cannot drag windows between monitors. This is a known XWayland limitation; some compositors handle it better than others. Try moving windows with keyboard shortcuts (e.g., Super+Shift+Arrow in GNOME).
Frequently Asked Questions
Q: Do I need to install XWayland separately?
A: Usually not—most Wayland compositors include it. But if you get an error like “cannot open displayâ€�, install the xwayland package from your distro’s repos.
Q: Why does my app still run under Wayland even when I set GDK_BACKEND=x11?
A: Some apps override that variable internally. Try unsetting WAYLAND_DISPLAY as well: env -u WAYLAND_DISPLAY GDK_BACKEND=x11 myapp.
Q: Can I run X11 apps on a pure Wayland session without XWayland?
A: No—XWayland is required for X11 apps. There’s no other way to run them on Wayland.
Q: Will X11 apps run faster under XWayland than native X11?
A: Usually slightly slower due to the extra translation layer, but for most apps the difference is negligible. Games may see a performance hit.
Q: How do I know if an app is using XWayland?
A: Run xlsclients (from x11-utils) in a terminal; it lists X11 clients connected to the X server, which includes XWayland.
Q: Can I force a Wayland-native app to run under X11?
A: Yes, but it’s not recommended. You can set GDK_BACKEND=x11 for GTK apps or QT_QPA_PLATFORM=xcb for Qt apps, but Wayland-native features like fractional scaling may not work.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Pause Snapchat Location
- System Restore Points Missing in Windows? Fixes
- Fix Device Manager Not Opening in Windows 11
- Loop Nature Ambience Videos with FFmpeg on Ubuntu
- Install League of Legends on Linux: Full Guide
- Fix Error 0x80070001: Causes & Solutions