hn.today

Building a Compositor for a Userbase of One

onewireout.com3 points0 comments
Screenshot of Building a Compositor for a Userbase of One

This describes RESONANCE, a custom Wayland compositor built to occupy a middle ground between floating and tiling window managers. Rather than letting windows pile up or forcing everything into a rigid grid, windows live on stacked "levels" (Basement, Ground, First, Second) that visually inset to convey depth; new windows map to Ground and are demoted upward if they overlap, promoted back down when space frees, and never force already-open windows to move. The compositor started from tinywl and grew into a full-featured system that handles multi-monitor layout, XWayland, layer-shell, server-side decorations, screen capture, pointer constraints, drag-and-drop, and an IPC port. Crucially, policy and placement live in a separate Python "brain" process communicating over a simple newline-delimited socket: the compositor reports events and accepts two commands (place and fullscreen), so window-decision logic can be edited and restarted mid-session without destabilizing the C compositor.

Key specifics include a persistent three-axis placement store (app_id → floor → per-window slots) with rules for when a geometry is recorded, monitor-aware replay, special handling for splashes and generic GTK dialogs, and fullscreen restoration semantics. A push-resize model prevents overlap by sliding at-most-one neighbor per axis with a 7 px gap and a 100 px minimum, recalculated live from committed frames; pushes do not chain and persist once applied. The separation of policy and execution, plus the spatial level model, yields a stable, readable workspace that avoids both chaotic stacking and intrusive automatic tiling.

Read on onewireout.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.