Skip to main content

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.

The wayland-protocols crate provides generated Rust bindings for the official Wayland protocol extensions maintained at gitlab.freedesktop.org/wayland/wayland-protocols. These bindings are layered on top of wayland-client and wayland-server, giving you typed access to extension interfaces — from XDG shell window management to presentation timing and session locking.
Full rustdoc documentation is available at docs.rs/wayland-protocols.

Installation

Add wayland-protocols to your Cargo.toml. You must enable at least one side feature (client or server) and, for non-stable protocols, the appropriate tier feature (staging or unstable):
[dependencies]
# Client-side bindings for stable and staging protocols
wayland-protocols = { version = "0.32", features = ["client", "staging"] }
[dependencies]
# Server-side bindings with all tiers
wayland-protocols = { version = "0.32", features = ["server", "staging", "unstable"] }

Feature flags

FeatureDescription
clientGenerate client-side (wayland-client) bindings. Adds a client submodule under each protocol module.
serverGenerate server-side (wayland-server) bindings. Adds a server submodule under each protocol module.
stagingInclude staging-tier protocols (ready for wider adoption but potentially replaced in a future major version).
unstableInclude legacy unstable protocols (identified by z prefix interfaces). Deprecated; prefer stable or staging equivalents where available.
You can enable both client and server simultaneously to use the same protocol definitions from both sides.

Stability tiers

Protocols in this crate are organised into three stability tiers, reflecting how mature and settled the protocol specification is.
Stable protocols are finalized and will not receive incompatible changes. They are unconditionally compiled and need no extra feature flag.Examples: xdg_shell, presentation_time, viewporter, linux_dmabuf, tablet (v2).
The unstable category is distinct from “experimental” or “broken” — many unstable protocols are widely supported in the ecosystem. However, they may eventually be replaced by staging or stable equivalents.

Protocol namespaces

The crate is organized into four top-level modules, each grouping related protocol families. Every protocol module contains client and/or server submodules (gated on the client / server features).

wayland_protocols::xdg — Window management

Protocols specifically related to window management and desktop shell functionality.
Module pathProtocolTierDescription
xdg::shellxdg_shellStableCore XDG shell protocol. Provides xdg_wm_base, xdg_surface, xdg_toplevel, and xdg_popup. The standard replacement for wl_shell.
xdg::activation::v1xdg_activation_v1StagingMechanism for a client to pass focus (activation token) to another toplevel.
xdg::decoration::zv1zxdg_decoration_v1UnstableNegotiate server-side vs. client-side window decorations.
xdg::foreign::zv1zxdg_foreign_v1UnstableExport/import surface handles across clients (e.g. for out-of-process dialogs).
xdg::foreign::zv2zxdg_foreign_v2UnstableVersion 2 of the XDG foreign protocol.
xdg::xdg_output::zv1zxdg_output_v1UnstableRicher output description: logical position, size, connector name.
xdg::toplevel_drag::v1xdg_toplevel_drag_v1StagingAttach an xdg_toplevel to a drag-and-drop operation, enabling detachable window panes.
xdg::dialog::v1xdg_dialog_v1StagingMark an xdg_toplevel as a dialog relative to another toplevel.
xdg::toplevel_icon::v1xdg_toplevel_icon_v1StagingSet per-toplevel icons from icon stock names or pixel data.
xdg::toplevel_tag::v1xdg_toplevel_tag_v1StagingAssign a persistent tag to toplevels for compositor rules and position memory.
xdg::system_bell::v1xdg_system_bell_v1StagingRing the system bell from a client.
Example — binding xdg_wm_base on the client:
use wayland_protocols::xdg::shell::client::xdg_wm_base;

// After obtaining `globals` from registry_queue_init:
let wm_base: xdg_wm_base::XdgWmBase =
    globals.bind(&queue.handle(), 1..=6, ()).unwrap();
Example — using the client submodule path:
// General pattern:
// wayland_protocols::<namespace>::<protocol>::client::<interface_module>::<InterfaceType>

use wayland_protocols::xdg::shell::client::{
    xdg_wm_base::XdgWmBase,
    xdg_surface::XdgSurface,
    xdg_toplevel::XdgToplevel,
};

wayland_protocols::wp — General purpose

General-purpose Wayland extension protocols not specific to any single subsystem.
Module pathProtocolTierDescription
wp::presentation_timewp_presentationStablePrecise feedback on presentation (flip) timing for smooth video playback and animations.
wp::viewporterwp_viewportStableScale and crop wl_surface contents independently of buffer size.
wp::linux_dmabuf::zv1zwp_linux_dmabuf_v1StableImport DMA-BUF hardware buffers as Wayland buffers for zero-copy rendering.
wp::tablet::zv1zwp_tablet_v1Stable (zv1 XML)Graphics tablet protocol v1 (legacy; prefer zv2).
wp::tablet::zv2zwp_tablet_v2StableGraphics tablet protocol v2: tablets, tools, pads.
wp::fractional_scale::v1wp_fractional_scale_v1StagingCompositor hint for fractional HiDPI scaling factors.
wp::color_management::v1wp_color_management_v1StagingDescribe color properties (SDR/HDR colorimetry) for surfaces and outputs.
wp::color_representation::v1wp_color_representation_v1StagingDescribe YCbCr pixel format conversion parameters.
wp::content_type::v1wp_content_type_v1StagingHint at the kind of content a surface will display (game, video, photo, etc.).
wp::cursor_shape::v1wp_cursor_shape_v1Staging + UnstableSet a cursor from a named icon stock instead of a custom surface. Requires both staging and unstable features.
wp::drm_lease::v1wp_drm_lease_v1StagingLease DRM resources from a compositor for direct rendering (e.g. VR headsets).
wp::tearing_control::v1wp_tearing_control_v1StagingOpt into tearing page flips for lower-latency rendering.
wp::single_pixel_buffer::v1wp_single_pixel_buffer_v1StagingCreate a single-pixel wl_buffer (combine with viewporter to fill solid-color regions).
wp::security_context::v1wp_security_context_v1StagingAttach a security context to a new Wayland connection (for sandboxes).
wp::alpha_modifier::v1wp_alpha_modifier_v1StagingApply a global alpha factor to a surface, offloaded to the compositor or KMS.
wp::linux_drm_syncobj::v1wp_linux_drm_syncobj_v1StagingExplicit GPU synchronization using DRM syncobj timeline points.
wp::fifo::v1wp_fifo_v1StagingAdd a display-refresh-cycle readiness constraint to surface commits.
wp::commit_timing::v1wp_commit_timing_v1StagingSchedule surface commits to be presented no earlier than a given time.
wp::pointer_warp::v1wp_pointer_warp_v1StagingRequest the pointer be moved to a position relative to a surface.
wp::fullscreen_shell::zv1zwp_fullscreen_shell_v1UnstableDisplay a surface full-screen without desktop shell management.
wp::idle_inhibit::zv1zwp_idle_inhibit_v1UnstableInhibit the compositor’s idle/screensaver behaviour.
wp::input_method::zv1zwp_input_method_v1UnstableInput method protocol (e.g. on-screen keyboards).
wp::input_timestamps::zv1zwp_input_timestamps_v1UnstableHigh-resolution timestamps for input events.
wp::keyboard_shortcuts_inhibit::zv1zwp_keyboard_shortcuts_inhibit_v1UnstableRequest the compositor forward all keyboard events to a surface.
wp::linux_explicit_synchronization::zv1zwp_linux_explicit_synchronization_v1UnstableOlder explicit sync protocol (pre-syncobj).
wp::pointer_constraints::zv1zwp_pointer_constraints_v1UnstableConfine or lock the pointer to a region or position.
wp::pointer_gestures::zv1zwp_pointer_gestures_v1UnstableMulti-touch pointer gesture events (swipe, pinch).
wp::primary_selection::zv1zwp_primary_selection_v1UnstableX11-style primary (middle-click) selection clipboard.
wp::relative_pointer::zv1zwp_relative_pointer_v1UnstableUnaccelerated relative pointer motion events (for FPS games).
wp::text_input::zv1zwp_text_input_v1UnstableText input interface v1.
wp::text_input::zv3zwp_text_input_v3UnstableText input interface v3.

wayland_protocols::ext — Miscellaneous extensions

Protocols that do not fit into the xdg or wp categories — often privileged compositor extensions.
Module pathProtocolTierDescription
ext::session_lock::v1ext_session_lock_v1StagingAllow a privileged client to lock the session and display custom graphics.
ext::idle_notify::v1ext_idle_notify_v1StagingReceive notifications when the user becomes idle or active.
ext::foreign_toplevel_list::v1ext_foreign_toplevel_list_v1StagingEnumerate toplevel windows from other clients (for taskbars, overview UIs).
ext::transient_seat::v1ext_transient_seat_v1StagingCreate independent temporary seats (for virtual input, remote desktop).
ext::image_capture_source::v1ext_image_capture_source_v1StagingIntermediary object for referencing capture sources (outputs, toplevels).
ext::image_copy_capture::v1ext_image_copy_capture_v1StagingCapture output or toplevel frames into client-provided buffers (screencopy).
ext::data_control::v1ext_data_control_v1StagingPrivileged control of data devices, including the clipboard.
ext::workspace::v1ext_workspace_v1StagingList and control workspaces/virtual desktops.
ext::background_effect::v1ext_background_effect_v1StagingApply visual effects (blur, etc.) to the background behind translucent surfaces.

wayland_protocols::xwayland — XWayland protocols

Protocols specifically for interoperability between XWayland and Wayland compositors.
Module pathProtocolTierDescription
xwayland::shell::v1xwayland_shell_v1StagingAssociate an X11 window with a wl_surface without the race condition of the old WL_SURFACE_ID client message approach.
xwayland::keyboard_grab::zv1zwp_xwayland_keyboard_grab_v1UnstableAllow XWayland to request that all keyboard events be forwarded to a specific surface (implementing X11 active keyboard grabs).

Module path patterns

All protocol bindings follow a consistent module path convention:
wayland_protocols::<namespace>::<protocol_name>[::version]::<side>::<interface_module>::<Type>
// wayland_protocols::xdg::shell::client::xdg_wm_base::XdgWmBase
use wayland_protocols::xdg::shell::client::xdg_wm_base::XdgWmBase;

Common examples

// Core window management
use wayland_protocols::xdg::shell::client::{
    xdg_wm_base::XdgWmBase,
    xdg_surface::XdgSurface,
    xdg_toplevel::XdgToplevel,
    xdg_popup::XdgPopup,
};

// Presentation timing (video, animation)
use wayland_protocols::wp::presentation_time::client::wp_presentation::WpPresentation;

// Viewport/scale
use wayland_protocols::wp::viewporter::client::wp_viewporter::WpViewporter;

// DMA-BUF (hardware buffer import)
use wayland_protocols::wp::linux_dmabuf::zv1::client::zwp_linux_dmabuf_v1::ZwpLinuxDmabufV1;

// Session lock (staging)
use wayland_protocols::ext::session_lock::v1::client::ext_session_lock_v1::ExtSessionLockV1;

// Fractional scaling hint (staging)
use wayland_protocols::wp::fractional_scale::v1::client::wp_fractional_scale_manager_v1::WpFractionalScaleManagerV1;

Using protocols with GlobalList

The typical pattern for binding an extension global on the client side:
[dependencies]
wayland-client = "0.31"
wayland-protocols = { version = "0.32", features = ["client", "staging"] }
use wayland_client::{globals::registry_queue_init, Connection};
use wayland_protocols::xdg::shell::client::xdg_wm_base::XdgWmBase;

let conn = Connection::connect_to_env().unwrap();
let (globals, mut queue) = registry_queue_init::<MyState>(&conn).unwrap();

// Bind xdg_wm_base at version 1 through 6, panics if not present
let wm_base: XdgWmBase = globals.bind(&queue.handle(), 1..=6, ()).unwrap();

wayland-protocols covers only the protocols maintained in the upstream wayland-protocols repository. Additional protocol bindings are available in separate crates:
CrateDescriptiondocs.rs
wayland-protocols-wlrwlroots-specific protocol extensions (layer shell, screencopy, output management, etc.)docs.rs/wayland-protocols-wlr
wayland-protocols-plasmaKDE Plasma-specific Wayland protocol extensionsdocs.rs/wayland-protocols-plasma
wayland-protocols-miscMiscellaneous additional protocols not in the above collectionsdocs.rs/wayland-protocols-misc
wayland-protocols-experimentalHighly experimental protocols still under active designdocs.rs/wayland-protocols-experimental
All of these follow the same module path pattern and client / server feature conventions as wayland-protocols.

Build docs developers (and LLMs) love