repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

docs(quickshell): inventory status widget APIs

22763177b730422eaff69bf1345e8e94a5325475

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (2)

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

Added
new file mode 100644
1 +# Quickshell Phase 2B Service/API Inventory — 2026-06-17
3 +Purpose: freeze the local API/runtime facts for Phase 2B bar status widgets before writing implementation code.
5 +Related:
7 +- [`2026-06-17-quickshell-hypr-companion-baseline.md`](2026-06-17-quickshell-hypr-companion-baseline.md)
8 +- [`2026-06-17-quickshell-parity-checklist.md`](2026-06-17-quickshell-parity-checklist.md)
9 +- [`../plans/2026-06-17-quickshell-hypr-companions-phase-2a-bar-shell.md`](../plans/2026-06-17-quickshell-hypr-companions-phase-2a-bar-shell.md)
11 +## Local runtime snapshot
13 +Commands run on the live system, non-mutating:
15 +```sh
16 +wpctl get-volume @DEFAULT_AUDIO_SINK@
17 +brightnessctl -m
18 +upower -i /org/freedesktop/UPower/devices/DisplayDevice
19 +iwctl station wlan0 show
20 +bluetoothctl show
21 +```
23 +Observed:
25 +```text
26 +wpctl: Volume: 0.30 [MUTED]
27 +brightness: intel_backlight,backlight,4261,96%,4437
28 +upower display:
29 + state: fully-charged
30 + energy-rate: 0 W
31 + percentage: 98%
32 +iwctl station wlan0 show:
33 + State connected
34 + Connected network wlan.bugabinga.net
35 + IPv4 address 192.168.178.20
36 +bluetooth show:
37 + Powered: yes
38 + Pairable: no
39 + Discovering: no
40 +```
42 +Implications:
44 +- Volume widget can validate muted state immediately.
45 +- Brightness widget should target/detect `intel_backlight` and current percent parsing is available from `brightnessctl -m`.
46 +- Battery widget can validate a visible X230 battery state immediately.
47 +- WiFi widget must use iwd, not NetworkManager.
48 +- Bluetooth widget can validate adapter-powered state immediately; connected device/battery requires paired device availability.
50 +## Quickshell ObjectModel rule
52 +Quickshell `ObjectModel` exposes a reactive list through `.values`.
54 +Use:
56 +```qml
57 +SomeService.items.values.find(item => ...)
58 +SomeService.items.values.length
59 +```
61 +Avoid assuming raw `model[index]` is reactive.
63 +## MPRIS widget API
65 +Module:
67 +```qml
68 +import Quickshell.Services.Mpris
69 +```
71 +Relevant singleton/property:
73 +- `Mpris.players`: `ObjectModel<MprisPlayer>`.
75 +Relevant `MprisPlayer` properties:
77 +- `trackTitle`: current title or `""`.
78 +- `trackArtist`: current artist or `""`.
79 +- `isPlaying`: true when playback state is playing.
80 +- `playbackState`: enum state.
81 +- `position`: seconds; not continuously reactive unless explicitly prodded, so do not poll for Phase 2B text-only widget.
82 +- `length`: track length seconds.
83 +- `volume`: player volume, not system sink volume.
84 +- `canGoNext`, `canGoPrevious`, `canTogglePlaying` for controls later.
86 +Relevant functions:
88 +- `next()`
89 +- `previous()`
90 +- `togglePlaying()`
91 +- `play()`
92 +- `pause()`
94 +Phase 2B display rule:
96 +```qml
97 +const player = Mpris.players.values.find(p => p.isPlaying) || Mpris.players.values[0] || null
98 +const text = player ? `${player.trackTitle} / ${player.trackArtist}` : ""
99 +```
101 +Current Ironbar parity:
103 +- Center text format: `{title} / {artist}`.
104 +- Truncate around 42 chars.
105 +- Idle hidden/empty.
106 +- Must avoid the current Ironbar 1Hz DBus error loop.
108 +## Pipewire volume widget API
110 +Module:
112 +```qml
113 +import Quickshell.Services.Pipewire
114 +```
116 +Relevant singleton/properties:
118 +- `Pipewire.defaultAudioSink`: default output node or `null` briefly.
119 +- `Pipewire.defaultAudioSource`: default input node or `null` briefly.
120 +- `Pipewire.nodes`: all nodes.
121 +- `Pipewire.ready`: initial sync complete.
123 +Hard requirement:
125 +```qml
126 +PwObjectTracker { objects: [ Pipewire.defaultAudioSink, Pipewire.defaultAudioSource ] }
127 +```
129 +Without a tracker, `PwNodeAudio` properties are invalid.
131 +Relevant `PwNodeAudio` properties:
133 +- `volume`: average volume; writable; real, normally `0.0..1.0` for this setup.
134 +- `muted`: writable boolean.
135 +- `volumes`: per-channel volumes.
137 +Phase 2B display/action rule:
139 +- Display current default sink volume as percent.
140 +- If muted, use muted visual state.
141 +- Scroll up: set `audio.volume = Math.min(1.0, volume + 0.02)`.
142 +- Scroll down: set `audio.volume = Math.max(0.0, volume - 0.02)`.
143 +- Right click: `audio.muted = !audio.muted`.
144 +- Middle click: open `wiremix` through command adapter.
146 +Keep external `wpctl` only as fallback if Quickshell direct writes fail in live verification.
148 +## Brightness widget API/boundary
150 +Quickshell has no documented stable backlight service in the current skill/API inventory.
152 +Use process adapter initially:
154 +- Read: `brightnessctl -m`
155 +- Parse CSV: `device,class,current,percent,max`
156 +- Current live shape: `intel_backlight,backlight,4261,96%,4437`
157 +- Scroll up: `brightnessctl -e4 -n2 set 5%+`
158 +- Scroll down: `brightnessctl -e4 -n2 set 5%-`
160 +Phase 2B requirements:
162 +- Use one polling process or timer, not per-frame.
163 +- Update after scroll commands.
164 +- Display `󰃠 {percentage}%`.
165 +- Match current Ironbar smooth-ish behavior as close as possible.
167 +## UPower battery widget API
169 +Module:
171 +```qml
172 +import Quickshell.Services.UPower
173 +```
175 +Relevant singleton/properties:
177 +- `UPower.displayDevice`: aggregate display device; may exist before ready.
178 +- `UPower.devices`: physical devices.
179 +- `UPower.onBattery`: true when discharging/running on battery.
181 +Relevant `UPowerDevice` properties:
183 +- `ready`: display device initialized.
184 +- `percentage`: percent value.
185 +- `state`: enum state.
186 +- `isLaptopBattery`: true for physical laptop battery entries in `UPower.devices`.
187 +- `timeToEmpty`, `timeToFull`: seconds.
188 +- `iconName`: system icon name.
190 +Phase 2B display/action rule:
192 +- Show only when a battery exists; X230 currently does.
193 +- Display `󰁹 {percentage}%`.
194 +- Warning <=20%.
195 +- Critical <=5% and discharging.
196 +- Left/middle click opens existing upower terminal command until a native popup is planned.
198 +## WiFi widget API/boundary
200 +Do not use Quickshell `Networking` for Phase 2B because it is NetworkManager-backed and the machine uses iwd + systemd-networkd.
202 +Use process adapter initially:
204 +- Read: `iwctl station wlan0 show`
205 +- Strip ANSI.
206 +- Connected state if line `State connected`.
207 +- Current connected network can be parsed from `Connected network` but current Ironbar only shows icon.
209 +Phase 2B display/action rule:
211 +- Connected: `󰖩`.
212 +- Disconnected/off: `󰖪 off`.
213 +- Poll interval around current Ironbar `30000ms`, or event source if later discovered.
214 +- Left/middle click opens `impala` through command adapter.
215 +- No NetworkManager dependency.
217 +## Bluetooth widget API
219 +Module:
221 +```qml
222 +import Quickshell.Bluetooth
223 +```
225 +Relevant singleton/properties:
227 +- `Bluetooth.defaultAdapter`: default adapter.
228 +- `Bluetooth.adapters`: all adapters.
229 +- `Bluetooth.devices`: all connected devices across adapters.
231 +Relevant `BluetoothAdapter` properties:
233 +- `enabled`: adapter powered/enabled.
234 +- `state`: detailed state.
235 +- `devices`: devices connected to this adapter.
236 +- `adapterId`: e.g. `hci0`.
237 +- `name`: system adapter name.
239 +Relevant `BluetoothDevice` properties:
241 +- `connected`: current connection state; writable but Phase 2B should not toggle.
242 +- `batteryAvailable`: true if battery is reported.
243 +- `battery`: `0.0..1.0` when available.
244 +- `name`, `deviceName`: display name.
245 +- `icon`: system icon.
246 +- `paired`, `trusted`, `blocked` for future management UI.
248 +Phase 2B display/action rule:
250 +- No adapter: empty string (Ironbar `not_found`).
251 +- Adapter disabled: `󰂲`.
252 +- Adapter enabled no connected devices: `󰂯`.
253 +- Connected device without battery: `󰂱`.
254 +- Connected device with battery: `󰂱 {percent}%`.
255 +- Left/middle click opens `bluetui` through command adapter.
256 +- Do not show a Bluetooth popup in Phase 2B.
258 +## CPU widget API/boundary
260 +Quickshell has no built-in CPU service in the current inventory.
262 +Use process adapter initially:
264 +- Prefer reading `/proc/stat` from QML/Process or a timer-backed `Process` command.
265 +- Update interval: current Ironbar `2s`.
266 +- Display: ` {cpu_percent:1}%`.
267 +- Left/middle click opens `btm` through command adapter.
269 +Implementation caution:
271 +- Avoid shelling out every frame.
272 +- A 2s timer with one lightweight read is acceptable.
274 +## Command adapter calls needed by Phase 2B
276 +Use one shared command service rather than per-widget shell strings.
278 +Methods needed:
280 +- `openWifi()` -> existing `wezterm start --class impala -- impala` policy.
281 +- `openBluetooth()` -> existing `wezterm start --class bluetui -- bluetui` policy.
282 +- `openSystemMonitor()` -> existing `wezterm start --class btm -- btm` policy.
283 +- `openAudioMixer()` -> existing `wezterm start --class wiremix -- wiremix` policy.
284 +- `openBattery()` -> existing upower loop command from `hypr/modules/apps.lua` until replaced.
286 +Keep exact process boundary centralized so Hypr Lua gets simpler later.
288 +## Phase 2B implementation order recommendation
290 +1. Add `CommandRunner.qml`/`Commands.qml` for external app launch boundaries.
291 +2. Add `StatusText.qml` or reuse `BarButton.qml` for compact text widgets.
292 +3. Add MPRIS widget first: no process boundary, direct Quickshell service.
293 +4. Add Pipewire volume widget: direct service and scroll/click writes.
294 +5. Add UPower battery widget: direct service.
295 +6. Add Bluetooth widget: direct service.
296 +7. Add WiFi widget: process adapter for iwd.
297 +8. Add CPU widget: timer/process adapter.
298 +9. Add brightness widget: process adapter and scroll commands.
299 +10. Validate all widgets with Ironbar still live.
301 +## Self-review
303 +- NetworkManager is explicitly excluded for WiFi.
304 +- `Quickshell.Bluetooth`, not `Quickshell.Services.Bluetooth`, is the correct Bluetooth import for v0.3.0.
305 +- Pipewire writes require `PwObjectTracker`.
306 +- MPRIS display does not need continuous position polling.
307 +- Brightness and CPU need bounded polling/process adapters because no stable Quickshell-native service was identified.

docs/super/specs/2026-06-17-quickshell-hypr-companions-architecture.md

Modified
125 125 ## Service responsibilities
127 +Phase 2B service/API facts are recorded in [`../inventory/2026-06-17-quickshell-phase-2b-service-api-inventory.md`](../inventory/2026-06-17-quickshell-phase-2b-service-api-inventory.md). Use that inventory before writing status widget code.
127 129 ### Theme service
129 131 Inputs: