wayland-rs is the definitive Rust implementation of the Wayland display protocol, the modern replacement for X11 on Linux and other Unix-like systems. Rather than generating thin wrappers over the CDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/smithay/wayland-rs/llms.txt
Use this file to discover all available pages before exploring further.
libwayland libraries, wayland-rs ships its own pure-Rust protocol implementation alongside optional C-library bindings — giving you the choice of a fully self-contained binary or seamless interoperability with the rest of the Wayland ecosystem. The workspace is structured as a set of focused crates that you compose according to your use case, from writing a desktop application to building a full compositor.
What problem does wayland-rs solve?
The Wayland protocol is defined by XML specifications that describe objects, interfaces, requests, and events. Consuming this protocol in a safe, ergonomic way from Rust requires:- FFI safety: wrapping
libwayland-client.so/libwayland-server.sowithout exposing unsafe code to callers. - Protocol code generation: turning XML specs into strongly-typed Rust structs, enums, and trait impls at compile time.
- Backend flexibility: supporting both a pure-Rust protocol engine (for static, dependency-free builds) and the system C libraries (for FFI interoperability with native Wayland code).
- Extension protocols: bundling the entire official
wayland-protocolsextension set so you don’t have to generate bindings yourself.
Core crates
These are the three crates most applications and compositors will add directly to theirCargo.toml.
wayland-client
Client-side bindings for the Wayland protocol. Provides the infrastructure for connecting to a compositor, managing Wayland objects, and dispatching events. This is the starting point for any Wayland application.
wayland-server
Server-side (compositor-side) bindings. Exposes the same typed object model as
wayland-client but from the compositor’s perspective — handling client connections, resource lifetimes, and request dispatch.wayland-protocols
Pre-generated bindings for the official wayland-protocols extension repository. Includes stable, staging, and unstable protocol sets, each guarded by a Cargo feature.
Auxiliary crates
wayland-egl
Enables OpenGL and Vulkan rendering by creating an
EGLSurface from any WlSurface. Required for GPU-accelerated client applications using EGL.wayland-cursor
Pure-Rust reimplementation of cursor-theme loading. Reads XCursor images from the system theme, uploads pixel data into
WlBuffers, and provides frame timing for animated cursors.Additional protocol extension crates
Beyond the corewayland-protocols crate, the workspace also publishes pre-generated bindings for several widely used third-party protocol collections:
| Crate | Description |
|---|---|
wayland-protocols-wlr | wlroots protocol extensions, popular on tiling compositors |
wayland-protocols-plasma | KDE Plasma-specific protocol extensions |
wayland-protocols-misc | Miscellaneous community protocol extensions |
wayland-protocols-experimental | Experimental protocols not yet in any official set |
Requirements
wayland-rs requires Rust 1.86 or later. If you use the
system Cargo feature (which delegates protocol handling to the C libraries), you also need libwayland 1.15 or later installed on the target system. The pure-Rust backend has no native library dependency at all.Pure-Rust backend vs. system backend
wayland-rs gives you two distinct protocol engines, switchable per crate via Cargo features:- Pure-Rust backend (default)
- System backend
The default backend is a complete Rust reimplementation of the Wayland wire protocol. It links no native libraries, making your binary fully self-contained. This is the right choice for:
- Applications distributed as static or portable binaries.
- Environments where
libwaylandmay not be present (e.g. embedded, container images). - Testing and CI, where you want to avoid system library dependencies.
Looking for a higher-level toolkit?
wayland-client is intentionally a low-level crate. It gives you full control over every Wayland object and event, but leaves application-level concerns such as seat handling, output management, and surface roles to you. If you are writing a desktop application and want batteries-included abstractions, consider Smithay’s Client Toolkit (smithay-client-toolkit), which is built directly on top of wayland-client and wayland-protocols and provides ready-made helpers for windows, popups, input, theming, and more.