How vodkanull/pudu works
1. What this repository is
- pudu is a single-process Wayland compositor built on wlroots.
- Architecturally, it sits at the boundary between Wayland clients and the Linux input/output stack, acting as both display server and window manager.
2. Top-level structure
- The repo is small and centered around src/.
- src/pudu.c is the main compositor implementation.
- src/pudu.h is the shared header for the compositor’s internal types and declarations.
- src/Makefile drives compilation.
- src/pudu.desktop packages it as a Wayland session for a display manager.
- src/config is the example/user config template.
3. Core runtime architecture
- The compositor starts from pudu, creates the Wayland server state, initializes wlroots backend components, and then enters the event loop.
- At runtime it mediates:
- input events from keyboard/mouse/touch via libinput/wlroots,
- surface events from Wayland clients,
- rendering/output updates through wlroots’ output/backend abstraction.
4. Main dependency stack
- The README makes the dependency boundary explicit: wlroots 0.19, Wayland, libxkbcommon, libinput, cairo, seatd, and a terminal app such as kitty.
- This indicates pudu is not a self-contained graphics stack; it relies on wlroots for most platform integration and protocol plumbing.
5. Wayland protocol boundary
- src/protocols/ contains protocol XMLs used by the compositor.
- Standard protocols include:
- xdg-shell.xml for normal application windows,
- wlr-layer-shell-unstable-v1.xml for panels/overlays,
- pointer-constraints-unstable-v1.xml for pointer confinement/locking.
- Custom extension protocols include:
- ext-session-lock-v1.xml for lock-screen/session-lock behavior,
- ext-workspace-v1.xml for workspace awareness.
- These XML files define the compositor’s external API surface and are important for diagramming client interaction points.
6. Window management model
- The README describes it as a minimal tiling compositor.
- That suggests the core logic in pudu.c manages:
- mapping new xdg-shell surfaces,
- arranging windows into tiling layout,
- handling focus and surface lifecycle,
- supporting manual movement/closing via compositor shortcuts.
- User interaction is centered on simple keyboard/mouse bindings rather than a separate window-manager process.
7. Input and session control
- Input flows from the seat/input layer into compositor actions:
- Super + Left Click drag moves windows,
- Super + C closes the focused window,
- Super + Enter launches the configured terminal.
- The need for seatd and the note about adding the user to input,seat show that direct TTY/session ownership is part of the runtime boundary.
8. Configuration path
- Configuration lives at ~/.config/pudu/config.
- The example config in src/config indicates runtime behavior is customizable without recompiling.
- The config likely controls keybindings and default terminal command, making it a small but important control plane separate from compositor code.
9. Build and packaging flow
- The build is local and source-based: clone repo → cd src → make.
- The output binary is copied into /usr/local/bin/.
- pudu.desktop is installed into /usr/share/wayland-sessions/ so a display manager can launch it as a session.
- This means packaging is intentionally lightweight and distro integration is manual.
10. External behavior and project constraints
- The README explicitly says XWayland is not supported, so the architecture is pure Wayland only.
- That is a meaningful boundary: legacy X11 clients are excluded from the supported client set.
- The project is also tested only on Arch Linux, which matters for the deployment/runtime assumptions around dependencies and seat management.
11. How to draw the architecture
- A useful diagram would show:
- Wayland clients on one side,
- pudu compositor in the center,
- wlroots + system libraries beneath it,
- seatd / kernel input-output stack below that,
- and config file + protocol XMLs as supporting inputs to the compositor build/runtime behavior.
- The compositor itself appears to be a single monolithic core, not a multi-service architecture.
12. Overall repo shape
- This repository is intentionally compact: one core compositor, a small set of protocol definitions, one example config, and install metadata.
- The key architecture question is not service decomposition, but rather which Wayland protocols and wlroots subsystems pudu enables and how it manages windows, focus, and input inside one event-driven process.
Main entry points: pudu.c pudu · protocols protocols · xdg-shell.xml xdg-shell · wlr-layer-shell-unstable-v1.xml layer-shell
Components 17
Core compositor
Main event-driven compositor process and shared internal API.
Protocols
Wayland protocol XMLs that define the compositor's client-facing surface.
- protocols · Repository-local Wayland protocol definitions consumed by the compositor.
src/protocols - xdg-shell · Standard shell protocol for normal application windows.
src/protocols/xdg-shell.xml - layer-shell · Protocol for panels, overlays, and other non-toplevel surfaces.
src/protocols/wlr-layer-shell-unstable-v1.xml - pointer constraints · Pointer confinement and locking for focused client interactions.
src/protocols/pointer-constraints-unstable-v1.xml - session lock · Compositor extension for lock-screen and session-lock behavior.
src/protocols/ext-session-lock-v1.xml - workspace · Compositor extension for workspace awareness and coordination.
src/protocols/ext-workspace-v1.xml
Support
Build, configuration, and session entry points.
- config · User-facing configuration template for bindings and defaults.
src/config - Makefile · Build entry point for compiling the compositor from source.
src/Makefile - session entry · Wayland session metadata for display manager launch.
src/pudu.desktop
Runtime stack
External libraries and system services the compositor sits on top of.
- Wayland · Base protocol boundary between clients and compositor.
- wlroots · Backend, rendering, and protocol plumbing used by the compositor.
- input stack · Keyboard, pointer, touch, and keymap handling via system libraries.
- seatd / kernel · Session ownership and low-level input/output access through the OS stack.
- display manager · External launcher that starts Pudu as a Wayland session.
- terminal · Configured default terminal launched by compositor shortcuts.
Connections 21
- Wayland → pudu: client surfaces · Wayland clients connect and present surfaces to the compositor.
- pudu → Wayland: serve protocol · The compositor exposes the Wayland server boundary back to clients.
- pudu → wlroots: uses backend · Pudu delegates rendering, outputs, and protocol plumbing to wlroots.
- wlroots → input stack: input events · wlroots routes keyboard and pointer events from libinput and related stacks.
- input stack → seatd / kernel: device access · Low-level input and session ownership come from seatd and the kernel.
- pudu → pudu.h: shared state · Core implementation uses the internal declarations and shared types.
- config → pudu: runtime settings · Configuration influences bindings, defaults, and compositor behavior.
- Makefile → pudu: builds · Source build compiles the compositor implementation.
- session entry → display manager: session launch · Desktop entry registers the compositor as a selectable session.
- display manager → pudu: starts session · Display manager can launch Pudu as the active Wayland session.
- protocols → xdg-shell: contains · Protocol bundle includes standard shell definitions.
- protocols → layer-shell: contains · Protocol bundle includes layer-shell definitions.
- protocols → pointer constraints: contains · Protocol bundle includes pointer confinement and lock definitions.
- protocols → session lock: contains · Protocol bundle includes session lock extension definitions.
- protocols → workspace: contains · Protocol bundle includes workspace extension definitions.
- xdg-shell → pudu: window mapping · Normal application windows are managed through xdg-shell.
- layer-shell → pudu: overlays · Panels and overlays are handled through layer-shell surfaces.
- pointer constraints → pudu: pointer lock · The compositor honors confinement and locking requests.
- session lock → pudu: lockscreen · Lock-screen flow is mediated through the session-lock extension.
- workspace → pudu: workspace state · Workspace awareness feeds compositor layout and focus decisions.
- pudu → terminal: launches · Keyboard shortcuts can spawn the configured terminal.