repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

feat(nuguland): unified clock renderer + left-aligned workspace tray

bc9d60515fce5b535f471223403bb4c2fdb50fa0

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Share one NuguClock component across both orientations: HH and MM split
by a thin accent rule (Rectangle, no glyph) — stacked in a column when
vertical, in a row when horizontal, replacing the plain HH:MM chip. Also
left-align the horizontal workspace tray so it no longer floats centred
with empty space before it.

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

Changed files (1)

quickshell/nuguland/Bar.qml

Modified
170 170 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.55) : "transparent"
173 - // Constant-position clock, pinned at bar centre so the eye always lands
174 - // on the same spot. Declared first so the strips can anchor to its edges.
175 - BarChip {
173 + // Clock: HH and MM split by a thin accent rule (Rectangle, not a glyph,
174 + // so it always renders). Pinned at bar centre on the long axis, nudged
175 + // back if the widgets need the room. Two instances — one per orientation
176 + // — share the NuguClock renderer; the strips anchor to whichever edge is
177 + // live.
178 + NuguClock {
176 179 id: clockChip
181 + stacked: false
178 182 visible: !root.vertical
179 - popoutName: "clock"
180 - label: root.chipLabel("clock")
181 - width: preferredWidth
182 - height: 26
183 - // Centred when the right-side widgets leave room, otherwise pinned
184 - // just left of them so the clock never overlaps a widget. For a
185 - // fixed widget set this x is still constant, so the glance target
186 - // stays put — on a wide monitor it lands at true centre.
187 183 x: Math.min(parent.width / 2 - width / 2, widgetsRow.x - width - 12)
188 184 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 {
187 + NuguClock {
196 188 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] || "--"
190 + stacked: true
203 191 visible: root.vertical
204 - width: Math.max(34, stackColumn.implicitWidth + 12)
205 - height: stackColumn.implicitHeight + 12
206 - radius: 9
207 192 anchors.horizontalCenter: parent.horizontalCenter
208 193 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)
229 - }
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"
237 - }
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)
245 - }
246 - }
248 - StateLayer {
249 - theme: root.theme
250 - checked: clockStack.selected
251 - onEntered: {
252 - if (root.surfaces)
253 - root.surfaces.hoverRegisteredPopout("clock");
255 - }
256 - onActivated: {
257 - if (root.surfaces)
258 - root.activatePopout("clock");
260 - }
261 - }
264 196 // LEFT zone: every output's workspaces, each output on its own faint
320 252 implicitHeight: tray.height
321 253 Layout.preferredWidth: tray.width
322 254 Layout.preferredHeight: tray.height
323 - Layout.alignment: Qt.AlignCenter
255 + // left-aligned along the horizontal row; centred in the
256 + // vertical column.
257 + Layout.alignment: root.vertical ? Qt.AlignHCenter : (Qt.AlignLeft | Qt.AlignVCenter)
325 259 Rectangle {
326 260 id: tray
658 + // Shared clock renderer. `stacked` lays HH / rule / MM in a column (vertical
659 + // bar); otherwise HH | rule | MM in a row (horizontal bar). The accent rule
660 + // is a Rectangle, so it never depends on a font glyph.
661 + component NuguClock: Rectangle {
662 + id: clk
664 + property bool stacked: false
665 + readonly property bool selected: root.surfaces && root.surfaces.popoutName === "clock"
666 + readonly property var clockParts: String(root.chipLabel("clock")).split(":")
667 + readonly property string hh: clk.clockParts[0] || "--"
668 + readonly property string mm: clk.clockParts[1] || "--"
670 + implicitWidth: clockContent.implicitWidth + (stacked ? 12 : 16)
671 + implicitHeight: clockContent.implicitHeight + (stacked ? 12 : 8)
672 + width: implicitWidth
673 + height: implicitHeight
674 + radius: 9
675 + color: !root.theme ? "transparent" : (selected ? root.theme.ui.focus : root.theme.withAlpha(root.theme.ui.minor, 0.1))
676 + clip: true
677 + Component.onCompleted: Qt.callLater(() => root.registerAnchor("clock", clk))
678 + onXChanged: root.registerAnchor("clock", clk)
679 + onYChanged: root.registerAnchor("clock", clk)
680 + onWidthChanged: root.registerAnchor("clock", clk)
681 + onHeightChanged: root.registerAnchor("clock", clk)
683 + GridLayout {
684 + id: clockContent
686 + anchors.centerIn: parent
687 + columns: clk.stacked ? 1 : 3
688 + rowSpacing: clk.stacked ? 3 : 0
689 + columnSpacing: 6
691 + NuguText {
692 + Layout.alignment: Qt.AlignCenter
693 + theme: root.theme
694 + variant: "meta"
695 + text: clk.hh
696 + color: !root.theme ? "transparent" : (clk.selected ? root.theme.content.backdrop : root.theme.content.normal)
699 + Rectangle {
700 + Layout.alignment: Qt.AlignCenter
701 + width: clk.stacked ? 16 : 2
702 + height: clk.stacked ? 2 : 14
703 + radius: 1
704 + color: root.theme ? root.theme.ui.accent : "transparent"
707 + NuguText {
708 + Layout.alignment: Qt.AlignCenter
709 + theme: root.theme
710 + variant: "meta"
711 + text: clk.mm
712 + color: !root.theme ? "transparent" : (clk.selected ? root.theme.content.backdrop : root.theme.content.normal)
716 + StateLayer {
717 + theme: root.theme
718 + checked: clk.selected
719 + onEntered: {
720 + if (root.surfaces)
721 + root.surfaces.hoverRegisteredPopout("clock");
724 + onActivated: {
725 + if (root.surfaces)
726 + root.activatePopout("clock");
724 732 component BarChip: Rectangle {
725 733 id: chip