The same engine on the command line
The pane binary applies a scripted sequence of operations and prints the resulting tiling, with the partition accounting on every step. This is a real, trimmed run of pane demo.
Rust ยท tiling window manager engine
Pane is a dependency free tiling window manager engine in pure Rust, zero external crates. It does not bind to a display server. It treats the screen as an abstract rectangle and computes exactly where every window goes, which makes the whole engine headless, testable, and provable: for any sequence of operations the tiled windows form an exact partition of the screen. Open windows, split, move, resize, float, and switch workspaces here, and watch the partition invariant recheck after every action.
* in the layout tree on the right.the headless engine the playground drives, the same partition invariant the Rust core asserts after every operation. the readout under the screen rechecks live.
The pane binary applies a scripted sequence of operations and prints the resulting tiling, with the partition accounting on every step. This is a real, trimmed run of pane demo.
Most tiling window managers weld their layout logic to X11, Wayland, or a specific OS. The interesting part, the algorithm that decides how windows share the screen, is buried under platform glue and cannot be reused or tested in isolation. Pane pulls that algorithm out on its own.
Real tiling window managers. They draw on a display server and manage real windows, and their layout core is tied to X11 or Wayland, so it is hard to reuse or test apart from the running compositor.
The layout core on its own. It treats the screen as an abstract rectangle, does no I/O, and binds to no display server, so it is headless, embeddable, and its partition invariant can be proven rather than hoped for.
Someone building a real window manager can use Pane as the layout engine and write only a thin backend that draws the rectangles it returns. An agent managing panes or viewports can drive it through a tiny operation API and trust the partition to stay consistent.
The building blocks
A leaf is a window, a split is two children with a direction and a ratio. Opening a window splits the focused leaf in two; closing one promotes its sibling.
Splits use integer arithmetic clamped so both children keep positive size and the two extents always sum to the parent exactly. No floating point drift, no rounding holes.
The tiled cells exactly tile the screen: zero overlaps, zero uncovered space, and with gaps on, covered area plus gap area equals the screen area exactly.
Focus and move pick the nearest window in a direction by cell center, with a deterministic tie break, so navigation is spatial and reproducible.
Independent layouts each keep their own tree and focus. Monocle zooms one window fullscreen and restores the exact previous tiling on exit.
The same operation sequence yields identical rectangles every run, which is what makes the fuzz gates and the command line output reproducible.
The green readout under the screen is not decoration. It is the same partition invariant the Rust engine asserts after every single operation in tests/partition.rs: the tiled window cells exactly tile the screen, zero overlaps and zero uncovered space, and with gaps on, covered area plus gap area equals the screen area exactly. The checker itself is unit tested against known bad layouts so the gate cannot silently pass a hole.
# bounded for CI, tunable by env vars; the check runs after every operation PANE_FUZZ_OPS=2000 PANE_FUZZ_RUNS=50 PANE_FUZZ_SEED=42 cargo test --release # heavy stress, ten million operations on the partition gate PANE_FUZZ_OPS=1000000 PANE_FUZZ_RUNS=10 PANE_FUZZ_MAX_WINDOWS=128 \ cargo test --release --test partition partition_holds_no_gap
Pane is a library plus a small binary, pure Rust with zero external crates. Embed the engine, or script it from the command line.
Build a WindowManager over a Rect, apply Op values, and read the placements from frame(). The modules split cleanly: geometry, tree, workspace, manager, invariant, and render.
The pane binary runs a scripted operation sequence and prints the tiling, with a configurable screen size and gap. Feed it a script argument or pipe one in.
cargo test runs the partition, tree consistency, and determinism gates, tunable through PANE_FUZZ_OPS, PANE_FUZZ_RUNS, and PANE_FUZZ_MAX_WINDOWS for heavy stress.
# build, test the correctness gates, lint with warnings denied cargo build --release cargo test cargo clippy --all-targets -- -D warnings # the binary applies a scripted sequence of operations and prints the tiling pane demo pane --gap 8 'open; open h; focus up; open v; resize right' pane --screen 1920x1080 --gap 4 'open; open v; open h'