TheDocumentation 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.
wayland-protocols crate bundles pre-generated Rust bindings for the official wayland-protocols repository. It is divided into four top-level modules — xdg, wp, ext, and xwayland — each covering a distinct area of the Wayland extension ecosystem. This page walks through the most commonly used protocols, shows how to opt into staging and unstable tiers, and demonstrates real client-side usage with XDG Shell.
Cargo setup
Addwayland-protocols to Cargo.toml alongside wayland-client or wayland-server. Stable protocols are available with only the client/server features; staging and unstable protocols require their respective feature flags.
XDG protocols (xdg module)
The xdg module contains protocols related to window management on desktop-oriented systems.
XDG Shell — xdg::shell (stable)
XDG Shell is the replacement for the old wl_shell global and is the standard way for clients to create application windows. It exposes four key objects:
| Object | Role |
|---|---|
xdg_wm_base | The compositor global; used to create xdg_surface objects and must respond to ping events |
xdg_surface | Wraps a wl_surface with XDG semantics; must be given a role (toplevel or popup) |
xdg_toplevel | Represents a normal application window with title, app-id, min/max size, and state |
xdg_popup | Represents a transient popup anchored to a parent surface |
Client example
The following is based on thesimple_window example from the wayland-client crate (abbreviated to focus on XDG Shell). It binds xdg_wm_base from the registry, creates an xdg_surface over a wl_surface, promotes it to an xdg_toplevel, and handles the mandatory configure/ack_configure handshake before attaching a buffer.
The
xdg_surface.ack_configure(serial) call is mandatory. Compositors will not render a surface that has not acknowledged its configure event. Always respond to xdg_surface::Event::Configure before committing a buffer.XDG Activation — xdg::activation (staging)
xdg_activation_v1 allows a client to request that the compositor raise another toplevel to the foreground. The requesting client obtains an activation token and passes it out-of-band (e.g. via D-Bus) to the target client, which then calls xdg_activation_v1.activate.
XDG Toplevel Drag — xdg::toplevel_drag (staging)
Enables detachable window panels: a client can attach an xdg_toplevel to an ongoing drag-and-drop operation so the compositor moves the window with the pointer.
XDG Dialog — xdg::dialog (staging)
Marks an xdg_toplevel as a dialog relative to another toplevel, giving the compositor a hint for placement and interaction policies.
XDG Toplevel Icon — xdg::toplevel_icon (staging)
Allows clients to set per-toplevel icons either by name (from the XDG icon stock) or by providing raw pixel data via wl_buffer.
XDG Toplevel Tag — xdg::toplevel_tag (staging)
Provides a stable identifier tag for toplevels, enabling compositors to restore window properties (position, size, stacking order) across application restarts.
XDG Decoration — xdg::decoration (unstable)
zxdg_decoration_manager_v1 lets a client and compositor negotiate whether window decorations (title bars, borders) should be drawn server-side or client-side.
XDG Output — xdg::xdg_output (unstable)
Extends wl_output with desktop-oriented information: the logical position of an output within the global compositor space, its logical size, and the connector name.
XDG Foreign — xdg::foreign (unstable)
Provides a mechanism for one client to export a surface handle (a string) that another client can import to create a cross-client parent/child surface relationship. Useful for out-of-process dialogs.
General-purpose protocols (wp module)
The wp module groups protocols that are useful across many different application types and are not specific to window management.
Viewporter — wp::viewporter (stable)
Decouples surface dimensions from buffer dimensions, enabling scaling and cropping without changing the underlying buffer.
Presentation Time — wp::presentation_time (stable)
Delivers precise feedback about when a frame was actually displayed, enabling smooth video playback and animation loops.
Linux DMA-BUF — wp::linux_dmabuf (stable)
The standard mechanism for zero-copy buffer sharing between GPU processes and the compositor. Used by multimedia and GPU-accelerated applications.
Tablet — wp::tablet (stable v2 / unstable v1)
Describes graphics tablet devices with support for pressure, tilt, rotation, and multiple tools.
Fractional Scale — wp::fractional_scale (staging)
Allows the compositor to advertise a non-integer scale factor (e.g. 1.5×) for a surface. The client should use wp_viewport to submit a buffer at the scaled resolution.
Color Management — wp::color_management (staging)
Enables clients to describe the color properties of their surface content and to observe the color characteristics of outputs, supporting HDR and wide-gamut workflows.
Linux DRM Syncobj — wp::linux_drm_syncobj (staging)
Provides explicit GPU synchronisation using Linux DRM timeline synchronisation objects, replacing implicit fence synchronisation.
Cursor Shape — wp::cursor_shape (staging, requires unstable for tablet)
A simpler way for clients to request a named cursor shape from the compositor, eliminating the need to manage cursor surface buffers for common cursors.
Tearing Control — wp::tearing_control (staging)
Allows a client to opt into asynchronous page flips (tearing) in exchange for lower input latency — useful for games.
Single Pixel Buffer — wp::single_pixel_buffer (staging)
Creates a 1×1 pixel wl_buffer that can be combined with wp_viewport to paint large solid-colour areas without allocating a full-size buffer.
Miscellaneous protocols (ext module)
The ext module covers protocols that do not fit neatly under xdg or wp. All of the following require the staging feature.
| Module | Interface | Purpose |
|---|---|---|
ext::idle_notify | ext_idle_notifier_v1 | Notify clients when the user has been idle for a given duration |
ext::session_lock | ext_session_lock_manager_v1 | Allow a privileged client to lock the session and display an arbitrary surface |
ext::foreign_toplevel_list | ext_foreign_toplevel_list_v1 | Enumerate all open toplevels across clients (for taskbars, docks) |
ext::image_capture_source | ext_image_capture_source_manager_v1 | Intermediate object for screen capture source negotiation |
ext::image_copy_capture | ext_image_copy_capture_manager_v1 | Capture output or toplevel content into client-provided buffers |
ext::data_control | ext_data_control_manager_v1 | Privileged clipboard management (read and set the selection) |
ext::workspace | ext_workspace_manager_v1 | List and control virtual workspaces |
Enabling staging and unstable protocols
The feature flags compose cleanly. Here is a referenceCargo.toml block for a client that uses stable, staging, and unstable protocols together: