XWayland

On this page 7

XWayland is a complete X11 server that runs as a client of a Wayland compositor, so applications written for the X Window System can keep working on a Linux desktop whose display stack is built on Wayland. It translates X11 windows into Wayland surfaces and forwards keyboard, pointer and touch input back to X clients, which makes it the main compatibility bridge between the two protocols.

Because thousands of programs, games and toolkits were written against X11 over several decades, no major Wayland desktop on Linux ships without XWayland support. GNOME, KDE Plasma, Sway and Hyprland all start it either at login or on demand when the first X client connects, and most users never notice which of their windows are native and which are bridged.

How XWayland bridges X11 clients to a compositor

XWayland works by embedding the X.Org server code in a process that, instead of driving the display hardware directly, draws into Wayland buffers. Each top-level X11 window becomes a Wayland surface, and the compositor places, scales and decorates that surface like any native window. The X server still speaks the full X11 protocol to its clients, so applications see an ordinary display such as :0 or :1.

A separate component, the X window manager inside the compositor, handles the X11 side of window management. Compositors such as Mutter, KWin and wlroots-based projects implement an internal X window manager that reads X properties such as WM_CLASS, _NET_WM_NAME and size hints, and then maps them to the compositor’s own window model. This pairing, often described as rootless mode, means that X windows appear individually rather than inside one large root window.

The following table lists the main components involved when an X11 program runs on a Wayland session.

ComponentRoleProtocol spoken
X11 clientLegacy application that draws windowsX11 via Unix socket
XWayland serverReceives X requests and renders into buffersX11 and Wayland
CompositorComposes all surfaces and routes inputWayland
Internal X window managerTranslates X window hints into compositor stateX11 (ICCCM, EWMH)
Kernel graphics stackProvides DRM, GBM and direct renderingDRM and KMS ioctls
Components in an XWayland session

For accelerated rendering, XWayland uses Glamor, an OpenGL-based acceleration layer, together with DRI3 and buffer sharing through dma-buf. An X application that renders with OpenGL or Vulkan therefore writes into GPU memory that the compositor can import directly, avoiding a costly copy. On NVIDIA hardware, full acceleration depends on driver support for GBM and explicit synchronization, which matured only in recent driver generations.

Startup modes and configuration

XWayland can be started in several ways, and the choice affects memory use, login time and reliability. Older desktops launched it unconditionally at session start, while current releases prefer lazy activation, in which the compositor listens on the X socket and launches the server only when a client connects.

ModeHow it startsTypical use
Always onStarted together with the sessionOlder GNOME and KDE Plasma releases
On demandStarted at the first X connectionCurrent GNOME, Sway and Hyprland
DisabledNever started, X sockets absentPure Wayland kiosks and test setups
RootfulRuns one full X desktop in a windowNested X sessions and legacy window managers
Common XWayland startup modes

In wlroots compositors, the xwayland option in the configuration file enables, disables or forces the server; GNOME exposes similar behavior through Mutter experimental features. Administrators who disable XWayland entirely gain a slightly smaller attack surface, but any program that still requires X11 will then fail to open a display.

XWayland compared with native Wayland and a full X server

XWayland sits between a traditional X11 session and a pure Wayland client, and its behavior inherits constraints from both worlds. The comparison below shows where an X application running through the bridge differs from the alternatives.

AspectNative Wayland clientX11 client on XWaylandX11 client on X.Org
Input isolationStrict per-client isolationX clients can observe each otherNo isolation between clients
Fractional scalingSharp at any scaleOften blurry when upscaledHandled by toolkit or not at all
Screen captureThrough portals and PipeWireOnly other X windows directlyWhole screen freely readable
Global hotkeysThrough portals or compositorOnly while an X window has focusUnrestricted key grabs
Tearing controlTearing-control protocolFollows compositor policyDriver and compositor dependent
Running an application three ways

The security point deserves attention. Inside XWayland, X clients can still read each other’s keystrokes and window contents, because the X11 protocol has no notion of isolation. However, they cannot see native Wayland windows, so a password manager running natively remains protected from a keylogger running as an X client.

Scaling, input and other practical limitations

The most visible limitation is HiDPI and fractional scaling. X11 has a single global coordinate space and no per-window scale factor, so the compositor usually renders X windows at scale 1 and then upscales the bitmap, which produces blurry text at 125 or 150 percent. Recent compositors offer an option to let XWayland windows render at native resolution, but then applications must apply their own scaling through toolkit settings or Xft.dpi.

Input is a second source of friction. Pointer warping, absolute cursor positioning and exclusive grabs, which many games and remote-desktop clients rely on, are emulated through Wayland pointer-constraints and relative-pointer protocols. The emulation works well in most titles, yet edge cases such as mouse lock in older engines can misbehave.

The next table maps common symptoms to their usual cause and remedy.

SymptomLikely causeUsual remedy
Blurry application textBitmap upscaling of X windowsEnable native XWayland scaling and set toolkit DPI
Screen sharing shows blackX tool cannot capture Wayland outputUse a portal-aware capture application
Hotkeys work only in focusNo global key grabs across protocolsBind shortcuts in the compositor
Flicker on NVIDIAMissing explicit synchronizationUpdate driver, XWayland and compositor
Clipboard loses contentOwner process exits before transferRun a clipboard manager
Typical XWayland problems and fixes

Clipboard and drag-and-drop between X and Wayland windows are proxied by the compositor, which translates X selections into Wayland data offers. This usually works transparently, although large transfers or unusual MIME types occasionally fail.

Identifying and reducing XWayland usage

Knowing which windows run through XWayland helps when diagnosing scaling or capture issues. The xlsclients command lists connected X clients, and tools such as xeyes only follow the cursor over X windows, which gives a quick visual test. KDE Plasma offers a window property inspector, and Hyprland reports an xwayland flag for every client.

Many applications can switch to native Wayland with a toolkit setting. GTK and Qt programs generally choose Wayland automatically, while Electron and Chromium applications need --ozone-platform-hint=auto or an equivalent flag, and Firefox uses MOZ_ENABLE_WAYLAND=1 on older releases. Java Swing, Wine and many games still depend on X11, so XWayland remains necessary for the foreseeable future; Wine has a native Wayland driver under active development but not yet universal.

A non-technical view

Linux desktops are moving from an old display system, X11, to a newer one called Wayland. Many older programs only know how to talk to the old system. XWayland is a translator that sits in the middle: it pretends to be the old system for those programs and passes their windows on to the new one.

Think of it as a travel adapter for a plug from another country. The device works as usual, but small differences can show, such as slightly blurry text on high-resolution screens. The key takeaway is simple: XWayland is why old applications still open on a modern Linux desktop.

A concrete example

A developer uses a laptop with a 14-inch 2880 x 1800 display running a Wayland session at 175 percent scaling. Native GTK and Qt programs look sharp, but an older Java-based database tool and a chat client built on Electron both appear noticeably fuzzy. Running xlsclients shows that both are connected through XWayland.

For the chat client, the developer adds --ozone-platform-hint=auto to its launcher, and it switches to native Wayland with crisp text. The Java tool has no Wayland backend, so the developer enables the compositor option that lets XWayland windows render unscaled and sets the toolkit scaling factor to 1.75. The result is sharp text in both applications, with the Java tool still running through XWayland but no longer blurred.