docs(nuguland): orientation (vertical/horizontal) design spec
442a1f6ea989ebad9405a42e9383a9bd88e4dc7e
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: 98f884968a37
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bugabingas dorkfiles
442a1f6ea989ebad9405a42e9383a9bd88e4dc7e
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
+169 / −0 text lines
new file mode 100644+169 / −0 text lines
# Nuguland Orientation (Vertical/Horizontal) Design**Date:** 2026-06-28**Status:** Approved, pending implementation## GoalLet the nuguland bar — and all its widgets, workspace pills, clock, andpopouts — render in either a horizontal (top edge, current default) or avertical (left edge) orientation. Vertical mode trades the scarcer verticalscreen space for horizontal by stacking widgets top-to-bottom and abbreviatinglabels.## RationaleVertical screen space is more scarce than horizontal. A left-edge bar frees thetop of the screen. The cost: text wants to flow left-to-right, so vertical modeabbreviates labels and special-cases the clock to stay glanceable when stacked.## ArchitectureOne source of truth. `shell.qml` owns `property string orientation`(`"horizontal"` | `"vertical"`, default `"horizontal"`). It is injected into theBar delegate and the SurfaceManager — no singleton, consistent with the existingDI pattern (inject required props via shell.qml). Orientation is threaded intoSurfaceManager through the same `setPopoutScreen` channel that already carries`barHeight`, so popout geometry has a single feed, not a parallel path.A single global orientation is correct: there is one bar (primary screen only),so orientation is not per-output.### Components touched- `shell.qml` — orientation property, `setOrientation` IPC, inject into Bar + SurfaceManager.- `Bar.qml` — anchors + internal layout switch (Row/Column), content-driven thickness, `abbreviate()`, stacked clock, vertical workspace pills, vertical clock-overlap guard.- `SurfaceManager.qml` — orientation + bar thickness aware popout geometry.- `PopoutHost.qml` — input-region origin + slide direction orientation aware.- `niri/cfg/keybinds.kdl` — toggle keybind for testing.- OSD and toast surfaces (`shell.qml`) — UNTOUCHED. They anchor top-right with fixed margins (`anchors { top: true; right: true }`, line ~328) and never read `barHeight`. A left bar does not conflict with a top-right OSD/toast.## Verification strategyVertical mode is locally testable — flip the flag, read geometry back. No secondmonitor needed (unlike the prior primary-screen work).- Chips stacked: `registeredAnchors` IPC → constant x, increasing y; bar width = max chip width.- Popout placed right: `popoutState` IPC → `currentRect.x ≈ barThickness`, not `y = barHeight`.- Abbreviation correct: pure `abbreviate()` + `abbreviateSelfTest` IPC asserting the stated cases.- Clock overlap: reuse the existing registeredAnchors y-span overlap check.Only final pixel legibility (abbreviated text readability, separator line) needsthe user's eyes.## Phase 1 — bar visualFully verifiable via `registeredAnchors`. Leaves popouts mispositioned invertical until Phase 2 (a review checkpoint, not a ship point).### Orientation flag + IPC`shell.qml`:- `property string orientation: "horizontal"`.- IPC `setOrientation(mode: string) : string` accepting `"horizontal"`, `"vertical"`, or `"toggle"`. Normalizes, assigns, returns the resulting orientation string. Unknown input is a no-op that returns the current value.### Bar layout switch| Aspect | horizontal | vertical ||--------------|-------------------------|-----------------------------------|| anchors | top, left, right | top, left, bottom || thickness | `implicitHeight: 34` | `implicitWidth`: content-driven || main layout | Row (3-zone) | Column (3-zone, top→bottom) || ws strip | Row of trays | Column of trays || ws pills | `idx name` | idx-only || clock | compact `HH:MM` | stacked HH / thin line / MM || chip labels | full words | `abbreviate()`-ed |The current 3-zone structure (workspace strip / clock / widgets) is preserved;only the flow axis flips. The clock stays the middle zone.### Content-driven thicknessPer the user's "not hardcoded" constraint, vertical bar width is derived:`implicitWidth = max(abbreviated chip widths)` (+ padding), never a magicconstant. This extends the de-hardcoding already done to chip widths.### abbreviate()One pure function, applied to both widget labels and workspace names,orientation-gated (full text when horizontal, abbreviated when vertical).Rule (user-authored): drop the vowels `a e i o u`, then truncate to 3 chars; ifthe vowel-dropped result is shorter than 3 chars, use the first 3 chars of theoriginal instead.Worked cases (these become the selftest assertions):- `notify` → `ntfy` → trunc 3 → `ntf`- `code` → `cd` → len 2 < 3 → first 3 of original → `cod`- `media` → `md` → len 2 < 3 → `med`- `system` → `systm` → trunc 3 → `sys`- `audio` → `d` → len 1 < 3 → `aud`- `power` → `pwr` → trunc 3 → `pwr`Note: this precise rule supersedes the looser earlier examples (`code→cd`,`notify→ntfy`); the algorithm governs. Exposed for verification via`abbreviateSelfTest` IPC returning `{pass, failures}`.### Stacked clockVertical clock renders as a small Column: HH text, a thin theme-colored`Rectangle` rule (font-independent — geometry, not a glyph, so no missing-glyphrisk), MM text.### Vertical clock-overlap guardThe clock-overlap bug already fixed on the x-axis has a y-axis twin in a Column.Reuse the same collision-aware pin —`Math.min(centerOffset, widgetsZone.start - clockExtent - gap)` — on the y-axis,and reuse the registeredAnchors overlap test (y-spans) to verify no overlap.### niri keybind`niri/cfg/keybinds.kdl`: a bind spawning`qs ipc -c nuguland call nuguland setOrientation toggle`(matching the existing `qs ipc -c nuguland call nuguland ...` pattern). Lets theuser flip modes live the moment `setOrientation` exists.## Phase 2 — popout geometryVerifiable via `popoutState`. Mirrors the top-bar assumptions to a left bar.### SurfaceManagerAdd `orientation` and use bar thickness (already received as `topBarHeight` in`setPopoutScreen`; generalize to thickness). When vertical:- `popupWindowAnchorRect()` → anchor at `{ x: barThickness, y: 0, width: 1, height: screenHeight }` (open from the left edge).- `popupCardFrame()` → card x slides rightward from `barThickness` (`barThickness - 18 + 26*t` analogue on the x-axis); y centered on screen height.- `popoutWidth()` / `heightBudget()` → swap the constrained axis so the popout is bounded by height minus margins, free on width.### PopoutHost- Input-region origin: `{ x: 0, y: barHeight }` → `{ x: barWidth, y: 0 }` when vertical (the card follows `currentRect`, but the hit region and slide origin are coded for the top bar).- Slide direction: from-top → from-left when vertical.## Out of scope (YAGNI)- Per-output / per-monitor orientation (single bar ⇒ global).- Auto-detecting orientation from aspect ratio (manual config + IPC toggle only).- Re-flowing OSD/toast around the bar (they stay top-right).- Animating the orientation transition (instant switch on toggle).## CommitsTwo commits, one per phase, each IPC-verified before requesting the user's eyes.