feat(algorithm): spiral #48

Closed
opened 2026-04-26 00:36:58 +00:00 by barrettruth · 1 comment
barrettruth commented 2026-04-26 00:36:58 +00:00

Add a spiral algorithm — recursively split panes in a spiral / Fibonacci pattern. This is a classic custom tiling layout from dwm and XMonad.

Scope

  • New file scripts/algorithms/spiral.sh
  • Hand-rolled tmux layout-string generation
  • Stable pane ordering so focus/promote behavior is predictable
  • Decide whether promote exists or whether this layout is relayout-only
  • Document orientation/rotation rules

Acceptance criteria

  • Setting @mosaic-algorithm spiral applies a deterministic spiral tiling
  • Split/kill hooks preserve the recursive pattern
  • Tests cover 3, 4, and 5+ pane cases
  • README includes behavior, supported operations, and screenshots

Implementation notes

Hard algorithm. Likely needs explicit layout-string generation and CRC handling rather than select-layout.

Part of #42.

Add a `spiral` algorithm — recursively split panes in a spiral / Fibonacci pattern. This is a classic custom tiling layout from dwm and XMonad. ## Scope - New file `scripts/algorithms/spiral.sh` - Hand-rolled tmux layout-string generation - Stable pane ordering so focus/promote behavior is predictable - Decide whether `promote` exists or whether this layout is relayout-only - Document orientation/rotation rules ## Acceptance criteria - [ ] Setting `@mosaic-algorithm spiral` applies a deterministic spiral tiling - [ ] Split/kill hooks preserve the recursive pattern - [ ] Tests cover 3, 4, and 5+ pane cases - [ ] README includes behavior, supported operations, and screenshots ## Implementation notes Hard algorithm. Likely needs explicit layout-string generation and CRC handling rather than `select-layout`. Part of #42.
barrettruth commented 2026-04-26 02:33:25 +00:00

I checked the real spiral / Fibonacci layouts before starting this.

The good news is that this one does map cleanly to tmux: it is a non-overlapping recursive split tree, so it fits tmux custom layout strings much better than deck or two-pane.

The main semantic choice is which upstream to treat as canonical:

  • dwm's fibonacci patch provides both spiral and dwindle from one implementation; the first split uses mfact, then the remaining space is split recursively by alternating axes and directions
  • XMonad's Spiral exposes a start direction, rotation, and a ratio parameter, which is a more configurable but different contract

For Mosaic, I think the cleanest first pass is to treat the dwm fibonacci patch as canonical for both spiral and dwindle:

  • explicit layout-string generation
  • stable tmux pane-order mapping
  • @mosaic-mfact controls the first split like dwm mfact
  • no extra rotation/orientation option in the first pass
  • likely relayout-only in the first pass, with promote left unsupported unless we find a very clear tmux-native meaning for it

That gives us a precise contract for spiral, and dwindle becomes the same generator with the sibling direction rule.

I checked the real `spiral` / Fibonacci layouts before starting this. The good news is that this one does map cleanly to tmux: it is a non-overlapping recursive split tree, so it fits tmux custom layout strings much better than `deck` or `two-pane`. The main semantic choice is which upstream to treat as canonical: - dwm's fibonacci patch provides both `spiral` and `dwindle` from one implementation; the first split uses `mfact`, then the remaining space is split recursively by alternating axes and directions - XMonad's `Spiral` exposes a start direction, rotation, and a ratio parameter, which is a more configurable but different contract For Mosaic, I think the cleanest first pass is to treat the dwm fibonacci patch as canonical for both `spiral` and `dwindle`: - explicit layout-string generation - stable tmux pane-order mapping - `@mosaic-mfact` controls the first split like dwm `mfact` - no extra rotation/orientation option in the first pass - likely relayout-only in the first pass, with `promote` left unsupported unless we find a very clear tmux-native meaning for it That gives us a precise contract for `spiral`, and `dwindle` becomes the same generator with the sibling direction rule.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/tmux-mosaic#48
No description provided.