Overview
TUIOS implements automatic window tiling using Binary Space Partitioning (BSP), an algorithm that recursively divides screen space to fit windows efficiently. Unlike rigid grid-based tiling, BSP adapts to any number of windows and allows fine-grained control over splits.Throughout this guide,
Ctrl+B refers to the default leader key. This is configurable via the leader_key option in your config file.Key Advantages
Flexible Layout
Works with any number of windows, not limited to powers of 2
Custom Sizing
Each window can have a different size based on your needs
Manual Control
Full control over split direction at any level of the tree
Persistent State
Per-workspace configuration survives sessions
Enable Tiling
Toggle tiling mode in Window Management Mode:Auto-Tiling Behavior
When tiling is enabled, TUIOS automatically positions new windows:- First window: Takes full screen
- Second window: Splits vertically (side-by-side)
- Third window: Splits horizontally (top/bottom on right side)
- Fourth+ windows: Spiral pattern (alternating V/H splits)
BSP Concepts
The Split Tree
Internally, TUIOS maintains a binary tree for each workspace:- Direction: Vertical (left/right) or Horizontal (top/bottom)
- Ratio: How space is divided (default 0.5 = 50/50)
Per-Workspace State
Each workspace maintains its own BSP tree. Switching workspaces preserves the tiling configuration on both sides. See Workspaces for details on multi-workspace usage.Manual Split Control
Rather than relying on automatic placement, you can manually split the focused window:Create Splits
Result: Three windows in an L-shaped layout.
Rotate Split Direction
Change an existing split’s direction:Preselection
Preselection lets you control where the next window spawns relative to the focused window.Preselection Commands
On macOS, use
Option+h/j/k/l instead of Alt.n. The preselection is consumed and resets.
Preselection Workflow
Creating a sidebar layout:
Result: Sidebar on left, main area on right with terminal below it.
Window Swapping
Rearrange windows without changing the underlying split structure:Swap Commands
Focus vs Swap:
h/j/k/lor arrow keys: Move focus between windowsShift+H/J/K/LorCtrl+arrows: Swap windows
Resizing in BSP Mode
BSP allows resizing along any split boundary.Master Ratio Adjustment
Control the size of the main window area (typically the leftmost window):Height Adjustment
Control the vertical split ratio of the focused window:Edge-Based Resizing
The distinction between edges matters in complex layouts:Right Edge (< / >)
Moves the right boundary of the master area, affects right-side windows
Left Edge (, / .)
Moves the left boundary of the master area, affects left-side windows
Bottom Edge ({ / })
Moves the bottom boundary of focused window
Top Edge ([ / ])
Moves the top boundary of focused window
Equalize Splits
Reset all splits to equal proportions:Practical Workflows
Workflow 1: Development Environment
Classic three-pane layout (editor + terminal + logs):Workflow 2: Wide Monitor Layout
For ultrawide monitors, create a three-column layout:Workflow 3: Dashboard Grid
Four equal quadrants:Workflow 4: CI/CD Monitor
Vertically stacked log viewers:Remote Control
Control tiling via CLI for automation:Implementation Details
Source Code
BSP implementation is ininternal/layout/bsp.go:
TileNodestruct - Binary tree node with split type and ratioInsertWindow()- Auto-placement using spiral schemeRemoveWindow()- Tree cleanup when windows closeApplyLayout()- Recursive rectangle calculation
internal/app/workspace.go:
TileVisibleWorkspaceWindows()- Tiles only the current workspaceWorkspaceTrees[workspaceNum]- Per-workspace BSP treesWorkspaceHasCustom[workspaceNum]- Manual split tracking
Automatic Scheme
Default scheme:SchemeSpiral (spiral pattern).
When auto-tiling:
- First window → root leaf
- Second window → root becomes vertical split, two leaves
- Third+ windows → finds the largest window, splits it (alternating directions)
Split Ratio Storage
Each internal node stores a ratio (default 0.5):- Represents the fraction of space given to left/top child
- Range: 0.3 to 0.7 (enforced to prevent unusable layouts)
- Adjustable via resize commands
State Persistence
In daemon mode, BSP state is serialized and restored across sessions:- Tree structure
- Split ratios
- Custom layout flags
- Master ratios
Troubleshooting
Windows Not Tiling
Check tiling is enabled
Check tiling is enabled
Status bar should show “TILING”. Press
t to toggle.Check workspace
Check workspace
Each workspace has independent tiling state. Try pressing
t on the current workspace.Too many windows
Too many windows
BSP handles any number of windows, but with 10+ windows, individual window size becomes impractical. Consider using multiple workspaces.
Unexpected Layout After Resize
Reset to balanced layout:Swap Not Working
Check direction: Swap commands are directional. If there’s no window in the specified direction, nothing happens. Try mouse drag: Mouse dragging always swaps if you drag one window onto another.Preselection Not Applied
Preselection is one-time: After creating a window, preselection resets. You need to preselect again for the next window. Cancel preselection: PressEsc in Window Management Mode to cancel a preselection without creating a window.
Related Documentation
- Workspaces - Each workspace has independent tiling state
- Keybindings - Complete keybinding list for tiling
- Configuration - Customize tiling behavior
- Architecture - Technical details on BSP implementation
Comparison with Other Tiling Algorithms
BSP vs. Grid
Grid Tiling
- Fixed positions (1, 2, 3, 4… windows)
- Wasted space with odd numbers
- Predictable but inflexible
BSP Tiling (TUIOS)
- Recursive splits adapt to any number
- No wasted space
- Full control over layout
BSP vs. Manual Tiling
Some window managers require you to manually tile every window. TUIOS offers both:- Auto-tiling for quick layouts
- Manual splits and preselection for precise control