← all posts

Building a TUI that doesn't fight the terminal

Notes on layout, focus, and redraw from shipping a small terminal dashboard.

Terminal UIs are a constraint engine: fixed cells, no sub-pixel anything, and a user who can resize you at any moment. The trick is to embrace it instead of emulating a browser.

Redraw only what changed

The naive loop clears and repaints the whole screen every frame. It flickers and burns CPU. Diff the cell buffer and write only the deltas.

~/dash — dashboard
┌─ pods ─────────────┐
│ api-7f9 Running │
│ web-2c1 Running │
│ job-aa0 Pending │
└────────────────────┘

Box-drawing characters and a tight color palette do all the visual work. No images, no chrome — just cells.

// up next