repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

docs(nuguland): orientation (vertical/horizontal) design spec

442a1f6ea989ebad9405a42e9383a9bd88e4dc7e

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Changed files (1)

+169 / −0 text lines

Diff layout

docs/superpowers/specs/2026-06-28-nuguland-orientation-design.md

Added
new file mode 100644

+169 / −0 text lines

1# Nuguland Orientation (Vertical/Horizontal) Design
2
3**Date:** 2026-06-28
4**Status:** Approved, pending implementation
5
6## Goal
7
8Let the nuguland bar — and all its widgets, workspace pills, clock, and
9popouts — render in either a horizontal (top edge, current default) or a
10vertical (left edge) orientation. Vertical mode trades the scarcer vertical
11screen space for horizontal by stacking widgets top-to-bottom and abbreviating
12labels.
14## Rationale
16Vertical screen space is more scarce than horizontal. A left-edge bar frees the
17top of the screen. The cost: text wants to flow left-to-right, so vertical mode
18abbreviates labels and special-cases the clock to stay glanceable when stacked.
20## Architecture
22One source of truth. `shell.qml` owns `property string orientation`
23(`"horizontal"` | `"vertical"`, default `"horizontal"`). It is injected into the
24Bar delegate and the SurfaceManager — no singleton, consistent with the existing
25DI pattern (inject required props via shell.qml). Orientation is threaded into
26SurfaceManager through the same `setPopoutScreen` channel that already carries
27`barHeight`, so popout geometry has a single feed, not a parallel path.
29A single global orientation is correct: there is one bar (primary screen only),
30so orientation is not per-output.
32### Components touched
34- `shell.qml` — orientation property, `setOrientation` IPC, inject into Bar +
35 SurfaceManager.
36- `Bar.qml` — anchors + internal layout switch (Row/Column), content-driven
37 thickness, `abbreviate()`, stacked clock, vertical workspace pills,
38 vertical clock-overlap guard.
39- `SurfaceManager.qml` — orientation + bar thickness aware popout geometry.
40- `PopoutHost.qml` — input-region origin + slide direction orientation aware.
41- `niri/cfg/keybinds.kdl` — toggle keybind for testing.
42- OSD and toast surfaces (`shell.qml`) — UNTOUCHED. They anchor top-right with
43 fixed margins (`anchors { top: true; right: true }`, line ~328) and never read
44 `barHeight`. A left bar does not conflict with a top-right OSD/toast.
46## Verification strategy
48Vertical mode is locally testable — flip the flag, read geometry back. No second
49monitor needed (unlike the prior primary-screen work).
51- Chips stacked: `registeredAnchors` IPC → constant x, increasing y; bar width =
52 max chip width.
53- Popout placed right: `popoutState` IPC → `currentRect.x ≈ barThickness`, not
54 `y = barHeight`.
55- Abbreviation correct: pure `abbreviate()` + `abbreviateSelfTest` IPC asserting
56 the stated cases.
57- Clock overlap: reuse the existing registeredAnchors y-span overlap check.
59Only final pixel legibility (abbreviated text readability, separator line) needs
60the user's eyes.
62## Phase 1 — bar visual
64Fully verifiable via `registeredAnchors`. Leaves popouts mispositioned in
65vertical until Phase 2 (a review checkpoint, not a ship point).
67### Orientation flag + IPC
69`shell.qml`:
70- `property string orientation: "horizontal"`.
71- IPC `setOrientation(mode: string) : string` accepting `"horizontal"`,
72 `"vertical"`, or `"toggle"`. Normalizes, assigns, returns the resulting
73 orientation string. Unknown input is a no-op that returns the current value.
75### Bar layout switch
77| Aspect | horizontal | vertical |
78|--------------|-------------------------|-----------------------------------|
79| anchors | top, left, right | top, left, bottom |
80| thickness | `implicitHeight: 34` | `implicitWidth`: content-driven |
81| main layout | Row (3-zone) | Column (3-zone, top→bottom) |
82| ws strip | Row of trays | Column of trays |
83| ws pills | `idx name` | idx-only |
84| clock | compact `HH:MM` | stacked HH / thin line / MM |
85| chip labels | full words | `abbreviate()`-ed |
87The current 3-zone structure (workspace strip / clock / widgets) is preserved;
88only the flow axis flips. The clock stays the middle zone.
90### Content-driven thickness
92Per the user's "not hardcoded" constraint, vertical bar width is derived:
93`implicitWidth = max(abbreviated chip widths)` (+ padding), never a magic
94constant. This extends the de-hardcoding already done to chip widths.
96### abbreviate()
98One pure function, applied to both widget labels and workspace names,
99orientation-gated (full text when horizontal, abbreviated when vertical).
101Rule (user-authored): drop the vowels `a e i o u`, then truncate to 3 chars; if
102the vowel-dropped result is shorter than 3 chars, use the first 3 chars of the
103original instead.
105Worked cases (these become the selftest assertions):
106- `notify` → `ntfy` → trunc 3 → `ntf`
107- `code` → `cd` → len 2 < 3 → first 3 of original → `cod`
108- `media` → `md` → len 2 < 3 → `med`
109- `system` → `systm` → trunc 3 → `sys`
110- `audio` → `d` → len 1 < 3 → `aud`
111- `power` → `pwr` → trunc 3 → `pwr`
113Note: this precise rule supersedes the looser earlier examples (`code→cd`,
114`notify→ntfy`); the algorithm governs. Exposed for verification via
115`abbreviateSelfTest` IPC returning `{pass, failures}`.
117### Stacked clock
119Vertical clock renders as a small Column: HH text, a thin theme-colored
120`Rectangle` rule (font-independent — geometry, not a glyph, so no missing-glyph
121risk), MM text.
123### Vertical clock-overlap guard
125The clock-overlap bug already fixed on the x-axis has a y-axis twin in a Column.
126Reuse the same collision-aware pin —
127`Math.min(centerOffset, widgetsZone.start - clockExtent - gap)` — on the y-axis,
128and reuse the registeredAnchors overlap test (y-spans) to verify no overlap.
130### niri keybind
132`niri/cfg/keybinds.kdl`: a bind spawning
133`qs ipc -c nuguland call nuguland setOrientation toggle`
134(matching the existing `qs ipc -c nuguland call nuguland ...` pattern). Lets the
135user flip modes live the moment `setOrientation` exists.
137## Phase 2 — popout geometry
139Verifiable via `popoutState`. Mirrors the top-bar assumptions to a left bar.
141### SurfaceManager
143Add `orientation` and use bar thickness (already received as `topBarHeight` in
144`setPopoutScreen`; generalize to thickness). When vertical:
145- `popupWindowAnchorRect()` → anchor at `{ x: barThickness, y: 0, width: 1,
146 height: screenHeight }` (open from the left edge).
147- `popupCardFrame()` → card x slides rightward from `barThickness`
148 (`barThickness - 18 + 26*t` analogue on the x-axis); y centered on screen
149 height.
150- `popoutWidth()` / `heightBudget()` → swap the constrained axis so the popout
151 is bounded by height minus margins, free on width.
153### PopoutHost
155- Input-region origin: `{ x: 0, y: barHeight }` → `{ x: barWidth, y: 0 }` when
156 vertical (the card follows `currentRect`, but the hit region and slide origin
157 are coded for the top bar).
158- Slide direction: from-top → from-left when vertical.
160## Out of scope (YAGNI)
162- Per-output / per-monitor orientation (single bar ⇒ global).
163- Auto-detecting orientation from aspect ratio (manual config + IPC toggle only).
164- Re-flowing OSD/toast around the bar (they stay top-right).
165- Animating the orientation transition (instant switch on toggle).
167## Commits
169Two commits, one per phase, each IPC-verified before requesting the user's eyes.