$ show Supreeeme/xwayland-satellite
xwayland-satellite is a production-grade rootless X11-to-Wayland bridge. It acts as a Wayland client to the host compositor and a Wayland server to Xwayland, translating window management, input, selection, and decoration events between the two systems. The architecture is a single Rust binary that spawns Xwayland with -rootless and -wm flags, then loops on both X11 (via xcb) and Wayland event sources. Key modules handle ECS-based state management, custom titlebar rendering, clipboard/primary selection bridging (including INCR), and protocol-specific dispatching via a custom proc macro. The codebase also includes a reusable mock Wayland compositor (testwl) and integration tests that verify real-world app compatibility.
The LLM identified 4 files worth highlighting for reuse:
Provides the `simple_event_shunt` procedural macro that reduces boilerplate for dispatching Wayland events. It generates a method that matches on event variants and calls corresponding handler functions. Self-contained and could be extracted to any Rust project using wayland-server to simplify event handling.
Contains generated Rust bindings for the `wl_drm` Wayland protocol. The crate is self-contained with its own Cargo.toml and XML protocol definition. It demonstrates a pattern for binding custom Wayland protocols that could be reused in other projects.
A reusable mock Wayland compositor for testing Wayland clients. Implements xdg_shell, wl_output, viewporter, primary selection, and other protocols. Fully self-contained and designed to be used as a dependency (as seen in tests/integration.rs). Could be extracted to test other Wayland clients without a real compositor.
Defines the `SelectionType` trait and implements clipboard and primary selection transfer between X11 and Wayland. The trait abstracts the differences between clipboard and primary, and the implementation handles incremental transfers (INCR). The pattern is reusable in any project needing bidirectional selection bridging.