wayland-rs is a workspace of Rust crates that implement the Wayland display protocol for both clients (applications) and servers (compositors). The suite spans from raw FFI bindings to a high-level, type-safe API generated directly from Wayland XML protocol specifications.Documentation 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.
Client Quickstart
Connect to a Wayland server and handle events in minutes with
wayland-client.Server Quickstart
Build a Wayland compositor using
wayland-server with typed dispatch.Architecture Overview
Understand the crate stack from raw FFI up to high-level protocol types.
Protocol Extensions
Use XDG Shell, wlroots, Plasma, and custom protocol extensions.
What’s in the workspace
wayland-rs hosts 12 crates, organized into three layers:wayland-client
High-level client-side API:
Connection, EventQueue, Dispatch.wayland-server
High-level server-side API:
Display, GlobalDispatch, Resource.wayland-protocols
Pre-generated bindings for all official Wayland protocol extensions.
wayland-backend
Low-level protocol logic with pure-Rust and system backends.
wayland-scanner
Proc-macros that generate Rust code from XML protocol specs.
wayland-cursor
Load cursor images from system XCursor themes.
Getting started
Add the crates you need
Add
wayland-client or wayland-server to your Cargo.toml depending on whether you are writing a client application or a compositor.Cargo.toml
Connect to a Wayland server (client side)
Use
Connection::connect_to_env() to open a connection using the environment’s socket path, then create an EventQueue to drive dispatch.Implement Dispatch for your state
Your application state implements
Dispatch<Object, UserData> for every Wayland object it handles. The library routes incoming events to the right implementation automatically.Requirements
wayland-rs requires Rust 1.86 or later. If you enable the
system feature to link against installed libwayland libraries, version 1.15 or later of the wayland system libraries is required.