How man33li/waylandshader-niri works
WaylandShader-niri adds native Slang shader effects and per-output color controls to the niri compositor. A user loads a preset or changes controls through the Qt controller or CLI; both use compositor-owned asynchronous D-Bus state. The runtime loads presets transactionally, shares preset parameters across outputs while maintaining per-output settings and temporal history, and applies effects at final presentation through niri’s GPU/render hooks and native bridge. Source excerpts are partial; runtime and bridge connections reflect the README’s architecture description rather than sampled implementation details.
Main entry points: lib.rs Shader manager · waylandshader/mod.rs Monitor render adapters · control.rs Control service · backend/mod.rs Output presentation
Components 17
Control clients
- Qt controller
waylandshader/client/controller_main.cpp - Controller D-Bus client
waylandshader/client/controller_client.cpp - Control CLI
waylandshader/client/ctl_main.cpp
Shader runtime
- Control service
waylandshader/runtime/src/control.rs - Shader manager
waylandshader/runtime/src/lib.rs - Settings and recents
waylandshader/runtime/src/lib.rs - Native bridge adapter
waylandshader/runtime/src/bridge.rs
Compositor integration
- niri compositor
src/niri.rs - Monitor render adapters
src/waylandshader/mod.rs - GPU adapter
src/waylandshader/gpu.rs - Output presentation
src/backend/mod.rs - TTY presentation
src/backend/tty.rs - Winit presentation
src/backend/winit.rs
GPU rendering
- GL and EGLImage processing
waylandshader/bridge.cpp
Other components
- User
- Slang preset files
- Display outputs
Connections 19
- User → Qt controller: controls
- User → Control CLI: commands
- Qt controller → Controller D-Bus client: calls
- Controller D-Bus client → Control service: D-Bus requests
- Control CLI → Control service: D-Bus requests
- Control service → Shader manager: dispatches
- Shader manager → Slang preset files: loads preset
- Shader manager → Settings and recents: updates state
- Control service → Settings and recents: reads and writes
- Shader manager → Native bridge adapter: passes shader work
- Native bridge adapter → GL and EGLImage processing: FFI calls
- niri compositor → Monitor render adapters: registers rendering
- Monitor render adapters → GPU adapter: uses GPU
- Monitor render adapters → Shader manager: invokes effects
- Output presentation → TTY presentation: selects backend
- Output presentation → Winit presentation: selects backend
- TTY presentation → Monitor render adapters: renders output
- Winit presentation → Monitor render adapters: renders output
- GL and EGLImage processing → Display outputs: processes frames