TUIOS: Terminal Multiplexer With Tiling WM and Kitty Graphics
2 min read
Originally from github.com
View source
My notes
Summary
TUIOS is a Go terminal multiplexer/window manager (Charm stack: Bubble Tea v2, Lipgloss v2) that replaces tmux’s fixed-rate redraw model with event-driven rendering, adds native kitty-graphics image/video passthrough, and layers in a BSP/niri-style tiling window manager on top of session persistence (daemon mode + session resurrection). It positions itself as tmux plus a real WM plus a Kitty-aware terminal emulator, in a single static Go binary.
Key Insight
- Event-driven rendering, not ticking: PTY reader goroutines push output through a buffered channel to trigger a Bubble Tea render, instead of redrawing on a fixed-rate timer. Result: near-zero idle CPU. This is a structural difference from most terminal multiplexers, which poll/refresh continuously even when nothing changed.
- Kitty graphics done properly, not just supported: most terminals that “support” the kitty graphics protocol still flicker or tear on video. TUIOS reuses image IDs across frames (no delete+re-place) and wraps graphics output in mode 2026 synchronized-output, batched with the render cycle, the stated result is flicker-free
mpv --vo=kittyplayback inside a multiplexed pane. Sixel is present but explicitly experimental (no pixel-level clipping yet). - Real tiling WM semantics, not just splits: BSP (binary space partitioning) tiling with spiral layout and preselection (control where the next pane spawns), plus a niri-inspired scrolling-columns layout and a master-stack layout, a feature set closer to Hyprland/niri window managers than to tmux’s manual pane splitting.
- Concrete performance engineering, not just claims: the changelog lists specific micro-optimizations, removed
defer/recoverfrom the style-comparison hot path (~20k calls/frame), LRU style cache with sequence-based change detection (40-60% allocation reduction), viewport culling for off-screen/minimized panes, and a fast render path for unfocused panes that uses the emulator’s built-inRender()instead of cell-by-cell iteration. - Session model matches tmux’s daemon/attach pattern but adds resurrection:
tuios new/attach/ls/kill-sessionmirror tmux, but sessions are stated to survive a daemon restart or full reboot, restoring pane structure and working directories, tmux itself has no built-in equivalent (that gap is normally filled by the separatetmux-resurrect/tmux-continuumplugins). - Scriptable via a tape DSL: a dedicated scripting language records/replays terminal workflows and can run headless in CI (
tuios tape run), and saved layouts can be exported directly to tape scripts, useful for reproducible demo environments or onboarding scripts, not just interactive use. - Driven by a JSON control protocol: the daemon exposes a documented JSON verb protocol, meaning external tools (or an agent) could drive pane creation/layout programmatically rather than only through keybindings, relevant for anyone building automation on top of a terminal environment.