$ show yshui/picom
picom is an X11 compositor that provides desktop visual effects such as window shadows, fading, blur, rounded corners, and animations. It is a fork of Compton and serves as a lightweight compositing manager for X11 window managers. The system is built around a modular architecture with pluggable rendering backends (XRender and OpenGL), a damage-based incremental renderer, a window tree manager, and a custom animation scripting engine. Key entry points include the main session initialization in `src/picom.c`, the event loop driven by libev, and the backend initialization. Data flows begin with X11 events (e.g., window creation, property changes) processed by the event handler, which updates the window tree and triggers damage computation. The renderer then builds a list of backend commands from window layers, applies damage culling, and presents the final image via the selected backend. External dependencies include X11 libraries (xcb, xlib, xrender, xdamage, xcomposite, xpresent, xrandr), libconfig for configuration, libev for event handling, pixman for region operations, and optional OpenGL, dbus, and pcre2. The project is actively maintained with a comprehensive test suite and CI/CD pipelines.
The LLM identified 2 files worth highlighting for reuse:
Implements a domain-specific language for matching X11 windows based on properties like class, name, role, and geometry. The parser builds a condition tree from a textual rule, and the evaluator matches windows against it. This component is self-contained, with no internal dependencies beyond standard C and uthash, and could be extracted as a standalone library for any rule-based window selection system.
Provides a bytecode compiler and interpreter for animation scripts. Scripts are defined in a config file, compiled into instructions (IMM, LOAD, STORE, OP, CURVE, BRANCH, HALT), and executed per window transition. The VM supports variables, cubic-bezier curves, constant propagation, and cycle detection. This component is isolated and could be reused for any animation or timeline-based scripting need.