repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

feat(nuguland): vertical bar layout — orientation flag, abbreviated labels, stacked clock

f3527d55b9a2a0fa4941adc1911e6e85feefd2a8

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Phase 1 of vertical/horizontal orientation. Bar anchors left with
content-driven thickness in vertical mode; widgets and workspace pills
stack top-to-bottom with vowel-dropped labels; the clock stacks HH/MM
around a thin accent rule with a y-axis overlap guard. A runtime
orientation flip remaps the layer surface (Mod+Shift+O keybind toggles
it). Popout geometry still assumes a top bar (Phase 2).

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

Changed files (4)

niri/cfg/keybinds.kdl

Modified
11 11 Mod+Space hotkey-overlay-title="Nuguland: launcher" {
12 12 spawn "uwsm" "app" "-s" "session-graphical.slice" "--" "qs" "ipc" "-c" "nuguland" "call" "nuguland" "openRegisteredPopout" "launcher"
14 + Mod+Shift+O hotkey-overlay-title="Nuguland: toggle bar orientation" {
15 + spawn "uwsm" "app" "-s" "session-graphical.slice" "--" "qs" "ipc" "-c" "nuguland" "call" "nuguland" "setOrientation" "toggle"
16 + }
14 17 Mod+B hotkey-overlay-title="Open Browser: firefox" {
15 18 spawn "uwsm" "app" "-s" "app-graphical.slice" "--" "firefox"

quickshell/nuguland/Bar.qml

Modified
25 25 required property QtObject lockService
26 26 required property QtObject surfaces
27 27 required property QtObject usageService
28 + required property QtObject formatService
29 + required property string orientation
31 + readonly property bool vertical: orientation === "vertical"
29 33 function chipLabel(name) {
30 34 switch (String(name)) {
98 102 function registerAnchor(name, item) {
99 - if (!root.surfaces || !item || item.width <= 0 || item.height <= 0)
103 + // Skip hidden items: the horizontal clock chip and the vertical clock
104 + // stack share the "clock" key, so only the visible one must register.
105 + if (!root.surfaces || !item || !item.visible || item.width <= 0 || item.height <= 0)
100 106 return ;
102 108 const rect = itemRectInBar(item);
121 127 function refreshSurfaceGeometry() {
122 - if (root.surfaces)
123 - root.surfaces.setPopoutScreen(Math.round(root.width), Math.round(root.screen ? root.screen.height : root.height), Math.round(root.height));
128 + if (root.surfaces) {
129 + const thickness = Math.round(root.vertical ? root.width : root.height);
130 + root.surfaces.setPopoutScreen(Math.round(root.screen ? root.screen.width : root.width), Math.round(root.screen ? root.screen.height : root.height), thickness, root.orientation);
127 134 screen: root.screen
135 + // horizontal: width spans (left+right anchored), implicitHeight sets bar
136 + // height. vertical: height spans (top+bottom anchored), implicitWidth sets
137 + // bar thickness from the widest chip content (never a magic constant).
128 138 implicitHeight: 34
139 + implicitWidth: root.vertical ? (Math.max(34, widgetsRow.implicitWidth, clockStack.width, workspaceStrip.implicitWidth) + 12) : root.width
129 140 color: "transparent"
130 141 WlrLayershell.namespace: "nuguland-bar"
131 142 WlrLayershell.layer: WlrLayer.Top
138 149 anchors {
139 150 top: true
140 151 left: true
141 - right: true
152 + right: !root.vertical
153 + bottom: root.vertical
144 156 Rectangle {
157 + id: barContent
145 159 anchors.fill: parent
146 160 color: "transparent"
162 + // accent edge: bottom hairline (horizontal) / right hairline (vertical)
148 163 Rectangle {
149 164 anchors.left: parent.left
150 - anchors.right: parent.right
151 165 anchors.bottom: parent.bottom
152 - height: 1
166 + anchors.right: root.vertical ? undefined : parent.right
167 + anchors.top: root.vertical ? parent.top : undefined
168 + width: root.vertical ? 1 : undefined
169 + height: root.vertical ? undefined : 1
153 170 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.55) : "transparent"
158 175 BarChip {
159 176 id: clockChip
178 + visible: !root.vertical
161 179 popoutName: "clock"
162 180 label: root.chipLabel("clock")
163 181 width: preferredWidth
170 188 anchors.verticalCenter: parent.verticalCenter
191 + // Vertical clock: HH over a thin accent rule over MM. The rule is a
192 + // Rectangle (geometry, not a glyph) so it always renders. Pinned at
193 + // bar centre on the y-axis, nudged up if the widgets need the room —
194 + // the y-axis twin of the horizontal clock's overlap guard.
195 + Rectangle {
196 + id: clockStack
198 + readonly property bool selected: root.surfaces && root.surfaces.popoutName === "clock"
199 + readonly property var clockParts: String(root.chipLabel("clock")).split(":")
200 + readonly property string hh: clockStack.clockParts[0] || "--"
201 + readonly property string mm: clockStack.clockParts[1] || "--"
203 + visible: root.vertical
204 + width: Math.max(34, stackColumn.implicitWidth + 12)
205 + height: stackColumn.implicitHeight + 12
206 + radius: 9
207 + anchors.horizontalCenter: parent.horizontalCenter
208 + y: Math.min(parent.height / 2 - height / 2, widgetsRow.y - height - 12)
209 + color: !root.theme ? "transparent" : (selected ? root.theme.ui.focus : root.theme.withAlpha(root.theme.ui.minor, 0.1))
210 + clip: true
211 + Component.onCompleted: Qt.callLater(() => root.registerAnchor("clock", clockStack))
212 + onXChanged: root.registerAnchor("clock", clockStack)
213 + onYChanged: root.registerAnchor("clock", clockStack)
214 + onWidthChanged: root.registerAnchor("clock", clockStack)
215 + onHeightChanged: root.registerAnchor("clock", clockStack)
217 + Column {
218 + id: stackColumn
220 + anchors.centerIn: parent
221 + spacing: 3
223 + NuguText {
224 + anchors.horizontalCenter: parent.horizontalCenter
225 + theme: root.theme
226 + variant: "meta"
227 + text: clockStack.hh
228 + color: !root.theme ? "transparent" : (clockStack.selected ? root.theme.content.backdrop : root.theme.content.normal)
231 + Rectangle {
232 + anchors.horizontalCenter: parent.horizontalCenter
233 + width: 16
234 + height: 2
235 + radius: 1
236 + color: root.theme ? root.theme.ui.accent : "transparent"
239 + NuguText {
240 + anchors.horizontalCenter: parent.horizontalCenter
241 + theme: root.theme
242 + variant: "meta"
243 + text: clockStack.mm
244 + color: !root.theme ? "transparent" : (clockStack.selected ? root.theme.content.backdrop : root.theme.content.normal)
248 + StateLayer {
249 + theme: root.theme
250 + checked: clockStack.selected
251 + onEntered: {
252 + if (root.surfaces)
253 + root.surfaces.hoverRegisteredPopout("clock");
256 + onActivated: {
257 + if (root.surfaces)
258 + root.activatePopout("clock");
173 264 // LEFT zone: every output's workspaces, each output on its own faint
174 265 // tray so it stays clear which pills belong to which monitor. Bounded by
175 266 // the clock on the right and clipped, so it never crosses centre.
176 - Row {
267 + // workspace strip: left zone (horizontal) / top zone (vertical), above
268 + // the clock. GridLayout unifies row/column flow.
269 + GridLayout {
177 270 id: workspaceStrip
272 + flow: root.vertical ? GridLayout.TopToBottom : GridLayout.LeftToRight
179 273 anchors.left: parent.left
180 - anchors.leftMargin: 10
181 - anchors.right: clockChip.left
182 - anchors.rightMargin: 12
183 - anchors.verticalCenter: parent.verticalCenter
184 - height: 26
185 - spacing: 8
274 + anchors.top: root.vertical ? parent.top : undefined
275 + anchors.leftMargin: root.vertical ? 0 : 10
276 + anchors.topMargin: root.vertical ? 10 : 0
277 + anchors.right: root.vertical ? parent.right : clockChip.left
278 + anchors.rightMargin: root.vertical ? 0 : 12
279 + anchors.bottom: root.vertical ? clockStack.top : undefined
280 + anchors.bottomMargin: root.vertical ? 10 : 0
281 + anchors.verticalCenter: root.vertical ? undefined : parent.verticalCenter
282 + anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
283 + rowSpacing: 8
284 + columnSpacing: 8
186 285 clip: true
188 287 Repeater {
198 297 required property var modelData
200 299 width: tray.width
201 - height: 26
300 + height: tray.height
301 + Layout.alignment: Qt.AlignCenter
203 303 Rectangle {
204 304 id: tray
206 - anchors.verticalCenter: parent.verticalCenter
207 - width: pillRow.implicitWidth + 12
208 - height: 26
209 - radius: 13
306 + anchors.centerIn: parent
307 + width: pills.implicitWidth + 12
308 + height: pills.implicitHeight + 12
309 + radius: 11
210 310 color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.07) : "transparent"
212 - Row {
213 - id: pillRow
312 + // pills: one output's workspaces. Flow follows the bar —
313 + // a horizontal row, or a vertical stack in vertical mode.
314 + GridLayout {
315 + id: pills
215 317 anchors.centerIn: parent
216 - spacing: 4
318 + flow: root.vertical ? GridLayout.TopToBottom : GridLayout.LeftToRight
319 + rowSpacing: 4
320 + columnSpacing: 4
218 322 Repeater {
219 323 model: groupItem.modelData.workspaces
224 328 required property var modelData
226 330 width: workspaceChip.width
227 - height: 26
331 + height: workspaceChip.height
332 + Layout.alignment: Qt.AlignCenter
229 334 Rectangle {
230 335 id: workspaceChip
232 337 readonly property bool active: !!pillWrap.modelData.is_focused
233 - readonly property string workspaceLabel: `${pillWrap.modelData.idx || pillWrap.modelData.id || "?"}${pillWrap.modelData.name ? ` ${pillWrap.modelData.name}` : ""}`.toLowerCase()
338 + readonly property string workspaceLabel: root.vertical ? String(pillWrap.modelData.idx || pillWrap.modelData.id || "?") : `${pillWrap.modelData.idx || pillWrap.modelData.id || "?"}${pillWrap.modelData.name ? ` ${pillWrap.modelData.name}` : ""}`.toLowerCase()
235 - anchors.verticalCenter: parent.verticalCenter
340 + anchors.centerIn: parent
236 341 width: Math.max(30, workspaceText.implicitWidth + 16)
237 342 height: 22
238 343 radius: 8
281 386 // RIGHT zone: glanceable widgets at natural width, anchored to the right
282 387 // edge so they never truncate while free space remains (the constraint
283 388 // that ruled out a fillWidth layout).
284 - RowLayout {
389 + // widgets zone: right edge (horizontal) / bottom edge (vertical).
390 + GridLayout {
285 391 id: widgetsRow
287 - anchors.right: parent.right
288 - anchors.rightMargin: 10
289 - anchors.verticalCenter: parent.verticalCenter
290 - spacing: 4
393 + flow: root.vertical ? GridLayout.TopToBottom : GridLayout.LeftToRight
394 + anchors.right: root.vertical ? undefined : parent.right
395 + anchors.rightMargin: root.vertical ? 0 : 10
396 + anchors.bottom: root.vertical ? parent.bottom : undefined
397 + anchors.bottomMargin: root.vertical ? 10 : 0
398 + anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
399 + anchors.verticalCenter: root.vertical ? undefined : parent.verticalCenter
400 + rowSpacing: 4
401 + columnSpacing: 4
292 403 Repeater {
293 404 model: root.usageService ? root.usageService.layoutOrder : []
296 407 required property var modelData
298 409 popoutName: modelData
299 - label: root.chipLabel(modelData)
410 + label: root.vertical ? root.formatService.abbreviate(root.chipLabel(modelData)) : root.chipLabel(modelData)

quickshell/nuguland/Format.qml

Added
new file mode 100644
1 +pragma ComponentBehavior: Bound
2 +import QtQuick
4 +// Tiny stateless text helper. Lives outside the Bar (a Variants delegate with
5 +// no stable id) so its pure functions can be gate-tested over IPC.
6 +QtObject {
7 + // Vertical-mode label shortener (user rule): drop vowels, truncate to 3;
8 + // if the vowel-dropped result is under 3 chars, fall back to the first 3
9 + // of the original.
10 + function abbreviate(text) {
11 + const s = String(text);
12 + const stripped = s.replace(/[aeiou]/gi, "");
13 + return (stripped.length >= 3 ? stripped : s).slice(0, 3);
14 + }
16 + function abbreviateSelfTest() {
17 + const cases = {
18 + "notify": "ntf",
19 + "code": "cod",
20 + "media": "med",
21 + "system": "sys",
22 + "audio": "aud",
23 + "power": "pwr",
24 + "idle": "idl",
25 + "tray": "try"
26 + };
27 + const failures = [];
28 + for (const key in cases) {
29 + const got = abbreviate(key);
30 + if (got !== cases[key])
31 + failures.push(`${key}: expected ${cases[key]}, got ${got}`);
32 + }
33 + return {
34 + "pass": failures.length === 0,
35 + "failures": failures
36 + };
37 + }

quickshell/nuguland/shell.qml

Modified
23 23 return screens.length > 0 ? String(screens[0].name) : "";
26 + // Bar orientation: "horizontal" (top edge, default) or "vertical" (left
27 + // edge). Injected into the Bar and the SurfaceManager so layout and popout
28 + // geometry share one source of truth.
29 + property string orientation: "horizontal"
31 + // Layer-shell surfaces size from anchors/implicitWidth only at map time, so
32 + // flipping orientation at runtime needs a remap: drop the bar then re-show
33 + // it a frame later to pick up the new thickness and anchored edges.
34 + property bool barRemap: true
36 + Timer {
37 + id: barRemapTimer
39 + interval: 60
40 + onTriggered: shell.barRemap = true
41 + }
43 + Format {
44 + id: format
45 + }
26 47 Theme {
27 48 id: nuguTheme
485 506 // primary monitor only; the bar consolidates every output's
486 507 // workspaces into per-output trays (see Bar.qml workspaceStrip).
487 - visible: modelData.name === shell.primaryScreenName
508 + visible: shell.barRemap && modelData.name === shell.primaryScreenName
488 509 screen: modelData
489 510 theme: nuguTheme
490 511 niriService: niri
504 525 lockService: lock
505 526 surfaces: surfaceManager
506 527 usageService: usage
528 + formatService: format
529 + orientation: shell.orientation
603 626 return JSON.stringify(niri.selfTest());
629 + function setOrientation(mode: string) : string {
630 + const want = String(mode);
631 + if (want === "toggle")
632 + shell.orientation = shell.orientation === "vertical" ? "horizontal" : "vertical";
633 + else if (want === "horizontal" || want === "vertical")
634 + shell.orientation = want;
636 + shell.barRemap = false;
637 + barRemapTimer.restart();
638 + return shell.orientation;
641 + function abbreviateSelfTest() : string {
642 + return JSON.stringify(format.abbreviateSelfTest());
606 645 function reloadTheme() {
607 646 nuguTheme.reload();
608 647 return nuguTheme.mode;