repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

feat(quickshell): add bar status widgets

df6ff7582521d74dc4355b79f9932d31c98cf78a

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (13)

docs/super/inventory/2026-06-17-quickshell-phase-2b-verification.md

Added
new file mode 100644
1 +# Quickshell Phase 2B Verification — 2026-06-17
3 +## Scope
5 +Phase 2B added hidden-bar status widgets for MPRIS, WiFi, Bluetooth, CPU, volume, brightness, and battery. Ironbar/Mako remain live. This is progress toward bar parity, not full companion-app parity.
7 +## Commands
9 +- `dbus-run-session -- timeout 3s qs -p quickshell/nugu/shell.qml`
10 +- temporary `XDG_CONFIG_HOME` named config with `qs -c nugu`
11 +- `qs ipc -c nugu call nugu showBar`
12 +- `qs ipc -c nugu call nugu setThemeMode light`
13 +- `qs ipc -c nugu call nugu setThemeMode dark`
14 +- `qs ipc -c nugu call nugu hideBar`
15 +- `wpctl get-volume @DEFAULT_AUDIO_SINK@`
16 +- `brightnessctl -m`
17 +- `upower -i /org/freedesktop/UPower/devices/battery_BAT0`
18 +- `iwctl station wlan0 show`
19 +- `bluetoothctl show`
20 +- `wdotool --backend wlr-protocols` right-click/scroll attempts
22 +## Parse validation
24 +Final parse/start validation under `dbus-run-session` exited `124` via timeout and printed `Configuration Loaded`.
26 +Relevant output:
28 +```text
29 +INFO: Configuration Loaded
30 +```
32 +No QML parse/type errors, no required-property errors, no binding loops, and no service import errors remained after fixes.
34 +Fixes found during validation:
36 +- `Commands.qml` cannot be a `QtObject` with `Process` children; it is now an invisible `Item`.
37 +- `commands: commands` in a `Variants` delegate shadowed itself; the root command object is now `commandBus`.
38 +- `StatusItem` subclasses must not redeclare inherited required `theme`; duplicate declarations caused required-property failures.
39 +- UPower `device.percentage` was normalized (`0.98`) on this host; `BatteryWidget` now normalizes `0..1` and `0..100` inputs.
41 +## Baselines
43 +```text
44 +Volume: 0.30 [MUTED]
45 +intel_backlight,backlight,4261,96%,4437
46 +battery state: fully-charged
47 +battery percentage: 98%
48 +iwd State: connected
49 +iwd Connected network: wlan.bugabinga.net
50 +bluetooth Powered: yes
51 +```
53 +## Visual validation
55 +Screenshots captured:
57 +- `/tmp/nugu-qs-2b-bar-dark.png`
58 +- `/tmp/nugu-qs-2b-bar-light.png`
59 +- `/tmp/nugu-qs-2b-battery-crop.png`
61 +Vision checks confirmed:
63 +- workspaces `1`, `2`, `3`, `4`, `5`, `9` still visible
64 +- clock visible in `HH:mm`
65 +- WiFi icon visible for connected iwd state
66 +- Bluetooth icon visible for powered adapter
67 +- CPU percent visible (`30%` at capture time)
68 +- volume visible as muted `30%`, matching `wpctl`
69 +- brightness visible as `96%`, matching `brightnessctl -m`
70 +- battery visible as `98%` after normalization fix, matching `upower`
71 +- light mode switched the Quickshell bar to a readable light Nugu palette
72 +- Ironbar remained visible above the Quickshell test bar
74 +No active MPRIS media player was visible during validation, so the media widget correctly collapsed to empty.
76 +## Interaction validation
78 +Automated pointer tests with `wdotool --backend wlr-protocols` showed:
80 +```text
81 +orig_volume=Volume: 0.30 [MUTED]
82 +after_volume_right=Volume: 0.30
83 +after_volume_right_restore=Volume: 0.30 [MUTED]
84 +```
86 +So right-click mute toggle works and was restored.
88 +Wheel verification is **not complete**:
90 +```text
91 +after_volume_scroll_-120=Volume: 0.30
92 +after_volume_scroll_120=Volume: 0.30
93 +after_brightness_scroll_-120=intel_backlight,backlight,4261,96%,4437
94 +after_brightness_scroll_120=intel_backlight,backlight,4261,96%,4437
95 +```
97 +The widget now uses `WheelHandler`, but `wdotool` did not produce effective wheel changes against the layer-shell bar in this agent session. This must be manually verified or retested with a different input tool before Phase 2B is considered fully accepted.
99 +All test changes were restored:
101 +```text
102 +Volume: 0.30 [MUTED]
103 +intel_backlight,backlight,4261,96%,4437
104 +```
106 +## Legacy service boundary
108 +```text
109 +ironbar.service active
110 +ironbar-workspaces.service active
111 +mako.service active
112 +quickshell.service inactive/not installed live
113 +```
115 +No lingering `qs` processes remained after validation.

quickshell/nugu/Bar.qml

Modified
7 7 id: root
9 9 required property QtObject theme
10 + required property QtObject commands
10 11 property bool shown: false
12 13 // Keep the Phase 2A bar opt-in. A visible property instead of destroying the
53 54 Layout.alignment: Qt.AlignCenter
54 55 spacing: 8
57 + MediaWidget { theme: root.theme }
56 58 ClockWidget { theme: root.theme }
60 62 Layout.fillWidth: true
61 63 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
62 64 spacing: 8
66 + WifiWidget { theme: root.theme; commands: root.commands }
67 + BluetoothWidget { theme: root.theme; commands: root.commands }
68 + CpuWidget { theme: root.theme; commands: root.commands }
69 + VolumeWidget { theme: root.theme; commands: root.commands }
70 + BrightnessWidget { theme: root.theme }
71 + BatteryWidget { theme: root.theme; commands: root.commands }

quickshell/nugu/BatteryWidget.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell.Services.UPower
3 +import "."
5 +StatusItem {
6 + id: root
8 + required property QtObject commands
10 + readonly property var device: UPower.displayDevice
11 + readonly property bool ready: device && device.ready
12 + readonly property real rawPercentage: ready ? device.percentage : 0
13 + // Quickshell/UPower can expose either 0..1 or 0..100 depending on backend.
14 + // Normalize here so the bar matches `upower -i` instead of lying in tests.
15 + readonly property int percent: ready ? Math.round(rawPercentage <= 1 ? rawPercentage * 100 : rawPercentage) : 0
16 + readonly property bool hasBattery: UPower.devices.values.some(d => d.isLaptopBattery)
18 + text: hasBattery && ready ? `󰁹 ${percent}%` : ""
19 + warning: percent <= 20 && percent > 5
20 + critical: UPower.onBattery && percent <= 5
21 + minWidth: 52
23 + // Keep the click behavior terminal-based for parity with the current Ironbar
24 + // diagnostics habit: visible raw UPower facts, no hidden abstraction yet.
25 + onLeftClicked: commands.openBattery()
26 + onMiddleClicked: commands.openBattery()

quickshell/nugu/BluetoothWidget.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell.Bluetooth
3 +import "."
5 +StatusItem {
6 + id: root
8 + required property QtObject commands
10 + readonly property var adapter: Bluetooth.defaultAdapter
11 + readonly property var connected: Bluetooth.devices.values.find(d => d.connected) || null
12 + readonly property int batteryPercent: connected && connected.batteryAvailable ? Math.round(connected.battery * 100) : -1
14 + text: !adapter ? "" : (!adapter.enabled ? "󰂲" : (connected ? (batteryPercent >= 0 ? `󰂱 ${batteryPercent}%` : "󰂱") : "󰂯"))
15 + muted: !adapter || !adapter.enabled
16 + minWidth: connected && batteryPercent >= 0 ? 50 : 18
18 + // The bar reports state only; pairing/troubleshooting still opens bluetui so
19 + // Quickshell does not become a second Bluetooth control surface yet.
20 + onLeftClicked: commands.openBluetooth()
21 + onMiddleClicked: commands.openBluetooth()

quickshell/nugu/BrightnessWidget.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell.Io
3 +import "."
5 +StatusItem {
6 + id: root
9 + property int percent: 0
11 + text: `󰃠 ${percent}%`
12 + minWidth: 52
14 + function refresh(): void {
15 + read.exec(["brightnessctl", "-m"])
16 + }
18 + // Keep brightness changes outside Quickshell state. brightnessctl is already
19 + // the desktop's authoritative control path and handles backlight constraints.
20 + onWheelUp: change.exec(["brightnessctl", "-e4", "-n2", "set", "5%+"])
21 + onWheelDown: change.exec(["brightnessctl", "-e4", "-n2", "set", "5%-"])
23 + Timer {
24 + running: true
25 + repeat: true
26 + interval: 10000
27 + triggeredOnStart: true
28 + onTriggered: root.refresh()
29 + }
31 + Process {
32 + id: read
33 + stdout: StdioCollector {
34 + onStreamFinished: {
35 + const fields = this.text.trim().split(",")
36 + if (fields.length >= 4) root.percent = parseInt(fields[3].replace("%", ""), 10)
37 + }
38 + }
39 + }
41 + Process {
42 + id: change
43 + onExited: root.refresh()
44 + }

quickshell/nugu/Commands.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell.Io
4 +Item {
5 + id: root
6 + visible: false
8 + // Keep all external process launches behind one object so status widgets stay
9 + // declarative and future Hypr bind migration has one command boundary to audit.
10 + property string sessionSlice: "session-graphical.slice"
11 + property string workSlice: "work.slice"
13 + function detached(args: var): void {
14 + runner.command = args
15 + runner.startDetached()
16 + }
18 + function uwsm(slice: string, args: var): var {
19 + return ["uwsm", "app", "-s", slice, "--"].concat(args)
20 + }
22 + function tui(slice: string, name: string): void {
23 + detached(uwsm(slice, ["wezterm", "start", "--class", name, "--", name]))
24 + }
26 + function openWifi(): void { tui(sessionSlice, "impala") }
27 + function openBluetooth(): void { tui(sessionSlice, "bluetui") }
28 + function openSystemMonitor(): void { tui(workSlice, "btm") }
29 + function openAudioMixer(): void { tui(sessionSlice, "wiremix") }
31 + function openBattery(): void {
32 + detached(uwsm(sessionSlice, [
33 + "wezterm", "start", "--class", "battery", "--",
34 + "nu", "-c", "loop { clear; upower -i /org/freedesktop/UPower/devices/battery_BAT0; sleep 2sec }"
35 + ]))
36 + }
38 + Process { id: runner }

quickshell/nugu/CpuWidget.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell.Io
3 +import "."
5 +StatusItem {
6 + id: root
8 + required property QtObject commands
10 + property int lastIdle: 0
11 + property int lastTotal: 0
12 + property int percent: 0
14 + text: ` ${percent}%`
15 + minWidth: 54
17 + // `/proc/stat` avoids spawning a full monitor until clicked and is cheap at a
18 + // 2s cadence, matching the current bar's small status role.
19 + onLeftClicked: commands.openSystemMonitor()
20 + onMiddleClicked: commands.openSystemMonitor()
22 + Timer {
23 + running: true
24 + repeat: true
25 + interval: 2000
26 + triggeredOnStart: true
27 + onTriggered: poll.exec(["sh", "-c", "awk '/^cpu /{print}' /proc/stat"])
28 + }
30 + Process {
31 + id: poll
32 + stdout: StdioCollector {
33 + onStreamFinished: {
34 + const parts = this.text.trim().split(/\s+/).slice(1).map(x => parseInt(x, 10))
35 + if (parts.length < 5) return
36 + const idle = parts[3] + parts[4]
37 + const total = parts.reduce((a, b) => a + b, 0)
38 + const deltaIdle = idle - root.lastIdle
39 + const deltaTotal = total - root.lastTotal
40 + if (root.lastTotal > 0 && deltaTotal > 0) {
41 + root.percent = Math.max(0, Math.min(100, Math.round((1 - deltaIdle / deltaTotal) * 100)))
42 + }
43 + root.lastIdle = idle
44 + root.lastTotal = total
45 + }
46 + }
47 + }

quickshell/nugu/MediaWidget.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell.Services.Mpris
3 +import "."
5 +StatusItem {
6 + id: root
9 + // MPRIS is optional. Show nothing when idle so the clock stays compact and
10 + // Ironbar remains the visual baseline for later full comparison.
11 + readonly property var player: Mpris.players.values.find(p => p.isPlaying) || Mpris.players.values[0] || null
12 + readonly property string title: player ? (player.trackTitle || "") : ""
13 + readonly property string artist: player ? (player.trackArtist || "") : ""
14 + readonly property string joined: title.length > 0 && artist.length > 0 ? `${title} / ${artist}` : (title || artist)
16 + text: joined.length > 42 ? `${joined.slice(0, 39)}…` : joined
17 + minWidth: 0

quickshell/nugu/README.md

Modified
42 42 Phase 2A only covers bar shell, workspaces, and clock. Full Ironbar parity requires later Phase 2B/2C plans.
44 +## Phase 2B status widgets
46 +Phase 2B adds partial Ironbar status parity while Ironbar remains live:
48 +- MPRIS media text
49 +- iwd WiFi status
50 +- Bluetooth status
51 +- CPU percent
52 +- Pipewire volume/mute with scroll/right-click/middle-click wiring
53 +- Brightness percent with scroll wiring
54 +- UPower battery percent
56 +Still deferred to Phase 2C: tray, clipboard entry point, bind mode, notification bridge, inhibit, power popup, calendar popup, full visual comparison.

quickshell/nugu/StatusItem.qml

Added
new file mode 100644
1 +import QtQuick
3 +Item {
4 + id: root
6 + required property QtObject theme
7 + property string text: ""
8 + property bool muted: false
9 + property bool warning: false
10 + property bool critical: false
11 + property bool active: false
12 + property int minWidth: 0
14 + signal leftClicked()
15 + signal middleClicked()
16 + signal rightClicked()
17 + signal wheelUp()
18 + signal wheelDown()
20 + // Shared status primitive keeps hover/active/error semantics identical across
21 + // Phase 2B widgets and prevents one-off colors from drifting away from Nugu.
22 + implicitWidth: Math.max(minWidth, label.implicitWidth + 14)
23 + implicitHeight: 22
24 + visible: text.length > 0
26 + Rectangle {
27 + anchors.fill: parent
28 + radius: 7
29 + color: root.active ? root.theme.ui.focus : (mouse.containsMouse ? root.theme.ui.accent : "transparent")
30 + }
32 + Text {
33 + id: label
34 + anchors.centerIn: parent
35 + text: root.text
36 + color: root.active || mouse.containsMouse
37 + ? root.theme.content.backdrop
38 + : (root.critical ? root.theme.error : (root.warning ? root.theme.warning : (root.muted ? root.theme.ui.minor : root.theme.ui.normal)))
39 + font.family: "IBM Plex Mono"
40 + font.pixelSize: 12
41 + font.features: { "tnum": 1 }
42 + elide: Text.ElideRight
43 + width: Math.min(implicitWidth, 240)
44 + }
46 + MouseArea {
47 + id: mouse
48 + anchors.fill: parent
49 + hoverEnabled: true
50 + acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
51 + onClicked: mouse => {
52 + if (mouse.button === Qt.MiddleButton) root.middleClicked()
53 + else if (mouse.button === Qt.RightButton) root.rightClicked()
54 + else root.leftClicked()
55 + }
56 + }
58 + WheelHandler {
59 + // WheelHandler is separate from MouseArea so scroll gestures remain
60 + // reliable on layer-shell surfaces while clicks keep their button routing.
61 + onWheel: event => {
62 + if (event.angleDelta.y > 0) root.wheelUp()
63 + else if (event.angleDelta.y < 0) root.wheelDown()
64 + }
65 + }

quickshell/nugu/VolumeWidget.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell.Services.Pipewire
3 +import "."
5 +StatusItem {
6 + id: root
8 + required property QtObject commands
10 + readonly property var sink: Pipewire.defaultAudioSink
11 + readonly property var audio: sink ? sink.audio : null
12 + readonly property int percent: audio ? Math.round(audio.volume * 100) : 0
14 + text: audio ? `${audio.muted ? "󰝟" : "󰕾"} ${percent}%` : ""
15 + muted: audio ? audio.muted : true
16 + minWidth: 52
18 + // Tracker keeps the Pipewire node alive; otherwise the default sink object can
19 + // disappear while the widget still has bindings to its audio interface.
20 + PwObjectTracker { objects: [ Pipewire.defaultAudioSink ] }
22 + onWheelUp: if (audio) audio.volume = Math.min(1.0, audio.volume + 0.02)
23 + onWheelDown: if (audio) audio.volume = Math.max(0.0, audio.volume - 0.02)
24 + onRightClicked: if (audio) audio.muted = !audio.muted
25 + onMiddleClicked: commands.openAudioMixer()

quickshell/nugu/WifiWidget.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell.Io
3 +import "."
5 +StatusItem {
6 + id: root
8 + required property QtObject commands
10 + property bool connected: false
12 + text: connected ? "󰖩" : "󰖪 off"
13 + muted: !connected
14 + minWidth: connected ? 28 : 52
16 + // The host uses iwd/impala, not NetworkManager. A bounded poll preserves that
17 + // integration without adding a new networking daemon dependency.
18 + onLeftClicked: commands.openWifi()
19 + onMiddleClicked: commands.openWifi()
21 + Timer {
22 + running: true
23 + repeat: true
24 + interval: 30000
25 + triggeredOnStart: true
26 + onTriggered: poll.exec(["sh", "-c", "iwctl station wlan0 show 2>/dev/null | sed 's/\\x1b\\[[0-9;]*m//g'"])
27 + }
29 + Process {
30 + id: poll
31 + stdout: StdioCollector {
32 + onStreamFinished: root.connected = this.text.indexOf("State") >= 0 && this.text.indexOf("connected") >= 0
33 + }
34 + }

quickshell/nugu/shell.qml

Modified
15 15 // instant and every widget uses the same Nugu semantic palette.
16 16 Theme { id: nuguTheme }
18 + // One command boundary keeps process launching out of widgets and makes later
19 + // Hypr config simplification a search-and-replace instead of archaeology.
20 + Commands { id: commandBus }
18 22 IpcHandler {
19 23 target: "nugu"
47 51 screen: modelData
48 52 theme: nuguTheme
53 + commands: commandBus
49 54 shown: root.barVisible