$ show niri-wm/niri
niri is a scrollable-tiling Wayland compositor written in Rust, built on the Smithay compositor library. It provides a dynamic workspace model with per-monitor vertical workspaces, an always-empty workspace at the bottom, and a tiling layout that supports floating windows, fullscreen, maximized, and tabbed modes. The compositor features a rich animation system (springs, easing curves), custom GLSL shaders for borders, shadows, blur, and window effects, and a comprehensive IPC interface for external tooling. It integrates with GNOME via D-Bus (screencasting, display config, accessibility) and supports PipeWire-based screencasting. Configuration is done via KDL files with live reload, includes, and merging semantics. The codebase is modular with separate crates for config parsing (niri-config), IPC protocol (niri-ipc), and visual tests (niri-visual-tests). It includes extensive unit, integration, snapshot, and property-based tests, as well as a visual test suite using GTK4. The architecture is a monolith compositor with well-defined subsystems for input handling, layout management, rendering, and protocol implementation.
The LLM identified 4 files worth highlighting for reuse:
Provides a generic Animation struct with support for spring physics, cubic bezier easing, and linear interpolation. Includes Clock for time management and separate Spring and CubicBezier implementations. This is a self-contained, reusable animation system that can be extracted for any project needing smooth value transitions.
Implements the MergeWith trait and associated macros (merge!, merge_clone!, merge_color_gradient!) for composable configuration merging. Allows partial overrides of nested config structures (e.g., border rules, shadow rules) with clear semantics. This pattern is reusable for any application with layered configuration.
Defines a set of composable render elements (TextureRenderElement, SolidColorRenderElement, ShadowRenderElement, BorderRenderElement, etc.) that can be combined into a render list. Each element handles its own GL state and damage tracking. This modular rendering architecture is reusable for any GLES-based compositor or custom rendering pipeline.
Provides a Fixture struct that sets up a minimal Wayland compositor environment for integration tests, including a headless backend, test input backend, and a simplified Client for sending Wayland requests. Includes helpers for snapshot testing and output management. This is a reusable test harness for any Smithay-based compositor.