dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Reviews Compare Notes Search Review guide CI runs network: spec + sanitized iwctl fixtures for popup redesign fbb879830781384897ff5fe7cc9cf8cad7848950
Oliver Jan Krylow <oliver@bugabinga.net > · 29 Jun 2026
unsigned
Browse files Compare with HEAD
Synthetic fixtures, byte-identical to real iwctl output format (ANSI
signal encoding, reset-at-line-start quirk, fixed-width columns, spaced
SSIDs). Plus edge cases: disconnected station, wifi-off device, empty
network list. No real MAC/BSSID/IP/neighbor SSIDs (repo pushes to GitHub).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Changed files (8) Diff layout Auto Unified Split
quickshell/nuguland/docs/superpowers/specs/2026-06-29-network-popup-redesign-design.md Added new file mode 100644+190 / −0 text lines
1 + # Network (Connectivity) Popup Redesign 4 + **Status:** approved (autonomous — standing /goal "ultracode next are audio, bright, networn and power")5 + **Popup:** 3 of 4 (audio ✅, brightness ✅, network ▶, power ⏳)9 + `Network.qml` is a **hollow stub**: `hostNetworks()→[]`, `wifiOn()→true`,10 + `scan/select/toggleWifi/forget/checkConnectivity` all no-op (set11 + `error="…owned-by-iwd"`). The ConnectivityPanel renders Bluetooth (real,12 + native `Quickshell.Bluetooth`) but the WiFi half shows nothing real.14 + Host runs **iwd**, not NetworkManager. `Quickshell.Networking` is NM-only →15 + **FORBIDDEN**. WiFi management must go through `iwctl` (the iwd CLI).19 + Build real iwd WiFi management — scan / list / connect / forget / toggle —20 + via `iwctl` Process calls plus a pure, node-tested parser. Keep the21 + Bluetooth half working untouched. Apply the solid-dark washout fix to the22 + WiFi view. Delete narration. Same architecture that shipped audio + brightness.24 + ## Architecture (the proven pattern) 26 + | Layer | File | Responsibility |27 + |-------|------|----------------|28 + | Pure logic | `network.js` | Parse raw `iwctl` text → plain data; shape/sort/role/label. NO I/O. Dual-mode export (node tests + QML import), like `clip.js`/`audio.js`/`brightness.js`. |29 + | Service (native boundary) | `Network.qml` | Spawn `iwctl` via `Process`, feed stdout to `network.js`, hold model + cadence, expose IPC. |30 + | View | `PopoutHost.qml` ConnectivityPanel | Pure graphical — WiFi list + connect flow + toggle; Bluetooth half unchanged. |32 + **Native boundary rule (unchanged):** native objects (`Process`,33 + `Quickshell.Bluetooth`) stay in QML. Only pure text-parsing / shaping /34 + formatting moves to `network.js` as plain-data functions. Raw `iwctl`35 + output (ANSI intact) is passed to `network.js`; **QML never pre-strips36 + ANSI** — signal strength is encoded in it.38 + ## iwctl command surface 40 + Device name is **discovered** (`iwctl device list` → first `station`-mode41 + device), never hardcoded `wlan0`.44 + list devices: iwctl device list45 + list networks: iwctl station <dev> get-networks46 + station state: iwctl station <dev> show47 + known nets: iwctl known-networks48 + scan (async): iwctl station <dev> scan # returns immediately49 + connect known/open: iwctl station <dev> connect <ssid>50 + connect new psk: iwctl --passphrase <pp> station <dev> connect <ssid>51 + forget: iwctl known-networks <ssid> forget52 + toggle wifi: iwctl device <dev> set-property Powered on|off53 + disconnect: iwctl station <dev> disconnect56 + ### Async scan (must not look broken) 58 + `scan` returns immediately; `get-networks` does **not** reflect new results60 + - `scan()` sets a real `scanning` state, spawns the scan, then re-reads61 + `get-networks` on a delayed/polled Timer (≈2 s, a couple of retries).62 + - `"Operation already in progress"` on stderr = scan-in-progress, **not** a63 + hard error → keep `scanning=true`, don't surface as error.65 + ## `network.js` — pure parser API (node-tested against fixtures) 67 + Fixtures: `test-fixtures/iwctl/*.txt` (synthetic, byte-identical to real68 + `iwctl` format — ANSI resets carried to line starts, fixed-width columns,69 + signal bars as bright-`*` then grey-`\x1b[1;90m*\x1b[0m`).72 + parseDevices(raw) -> [{ name, address, powered:bool, mode }]73 + deviceForStation(devices) -> first mode==="station" name74 + parseNetworks(raw) -> [{ ssid, security, signal:0..4, connected:bool }]75 + parseStation(raw) -> { scanning:bool, state, connectedNetwork, ipv4, security, rssi }76 + parseKnown(raw) -> [{ ssid, security }]79 + Shaping / view helpers (pure):81 + mergeNetworks(networks, known, station) -> enrich each net:82 + { ...net, known:bool, connected:bool, needsPassphrase:bool }83 + needsPassphrase(security, known) -> security!=="open" && !known84 + signalRole(bars) -> "ui.minor" (≤1) | "ui.accent" (2–3) | "content.accent" (4)85 + signalGlyph(bars) -> nerd-font wifi glyph by strength86 + securityLabel(sec) -> "open" -> "Open", "psk" -> "WPA", "8021x" -> "Enterprise"87 + networkId(ssid) -> stable id (ssid itself; never empty)88 + sortNetworks(list) -> connected first, then signal desc, then ssid asc91 + ### Parser correctness facts (bake into tests) 93 + - **Signal bars** = count of bright `*` *before* the first94 + `\x1b[1;90m` grey marker in the signal column; if no grey marker, all 495 + bright. Fixture rows: `home-wifi`→2, `home-wifi-5g`→4,96 + `Cafe Guest WiFi`→3, `Reading Room`→2, `Neighbor 2G`→1.97 + - **Names contain spaces** (`Cafe Guest WiFi`, `Reading Room`) → fixed-column98 + slice (visible cols: name 6–39, security 40–59, signal 60+), NOT99 + whitespace split. Strip ANSI for name/security columns only.100 + - **Connected marker** = visible `> ` at cols 2–3 (`home-wifi` is connected).101 + - **Leading `\x1b[0m`**: the first data row begins with a stray reset102 + (iwctl carries the previous line's reset to the next line's start) — must103 + not break lead/marker detection.104 + - **Edge fixtures must not throw**: `station-show-disconnected.txt`105 + (no Connected network / RSSI lines), `device-list-off.txt`106 + (`Powered off`), `get-networks-empty.txt` (header only, zero rows).108 + `network.test.js` prints `network.test.js: ALL PASS`, asserts the specific109 + rows above + every edge fixture.111 + ## `Network.qml` — service 113 + - Replace all stub bodies with real `Process`-driven impls.114 + - Discover device once on load; cache name.115 + - `refresh()`: run `device list`, `get-networks`, `known-networks`,116 + `station show`; parse each; `mergeNetworks` → model.117 + - `scan()`: spawn scan, set `scanning`, delayed re-`refresh()`.118 + - `connect(ssid, passphrase)`, `forget(ssid)`, `toggleWifi(on)`,119 + `disconnect()` — all real.120 + - Preserve the IPC contract (consumed by `shell.qml` IpcHandlers /121 + `stateJson`): `stateJson`, `scan`, `select`/`connect`, `toggleWifi`,122 + `forget`, `checkConnectivity`. Add `selfTest()` (runs parser over fixtures123 + inline? no — fixtures aren't shipped to runtime; `selfTest()` runs the124 + pure functions over small inline literals, like audio/brightness).125 + - **Delete narration**: `connectivityPanelContract()`, backend metadata126 + (`usesNativeQuickshellNetworking`, `hostStack`, `nativeApi`, …), the127 + `network-mini-graph` shader descriptor.129 + ### Security (HARD — written normal, not caveman) 131 + - All `iwctl` invocations use **discrete argv** arrays132 + (`["iwctl","--passphrase",pp,"station",dev,"connect",ssid]`). NEVER133 + `sh -c "…interpolated…"`: SSIDs may contain spaces, quotes, and shell134 + metacharacters → command injection. (Contrast brightness, which uses135 + `sh -c` on a trusted device path; here the inputs are untrusted.)136 + - The passphrase MUST NEVER enter `stateJson`, `lastAction`, `error`, or any137 + log line. It exists only as a transient argument to the connect call.138 + - Known tradeoff: `iwctl --passphrase <pp>` is briefly visible in139 + `ps`/`/proc/<pid>/cmdline`. Acceptable on a single-user laptop;140 + documented here. (Zero-leak alternative = iwd DBus agent; out of scope —141 + its stdin prompt is tty-bound and unreliable when piped.)143 + ## View — ConnectivityPanel (WiFi half only; Bluetooth untouched) 145 + - **Washout fix** (memory `nuguland-popup-frame-light-washout`): popup frame146 + is light. Never tint the card fill with low-alpha accent — it bleeds white.147 + Solid dark base `theme.withAlpha(theme.ui.backdrop, 0.55)`148 + (connected/selected ≈0.82); identity via a thin accent bar + border;149 + signal/role color on the bar + glyph, not the fill.150 + - Header row: `WiFi [on/off toggle] [scan ⟳]` (scan spins while `scanning`).151 + - Network rows (sorted): glyph (signal) • ssid • security/connected label •152 + action. Connected row gets `[forget]`; others `[connect]`.153 + - **Connect flow (stateful — spell out so secured connect doesn't silently155 + - **open** network → `[connect]` calls connect directly (no passphrase).156 + - **known** network (iwd has the secret) → `[connect]` calls connect158 + - **new secured** network (`needsPassphrase`) → tapping `[connect]` reveals159 + an inline passphrase field + confirm; confirm calls160 + `connect(ssid, passphrase)`. Field is `echoMode: TextInput.Password`,161 + cleared immediately after submit, never bound into any state object.162 + - Bluetooth half: render exactly as today (native `Quickshell.Bluetooth`).165 + ## Verification (controller does, after build — NOT subagents) 167 + 1. `node network.test.js` → ALL PASS.168 + 2. `rm -rf ~/.cache/quickshell/qmlcache` → restart `quickshell.service`.169 + 3. `journalctl --user -u quickshell.service` → no errors.170 + 4. `qs -c nuguland ipc call nuguland networkSelfTest` → all pass.171 + 5. Open connectivity popout → screenshot → crop → Read; verify WiFi list,172 + signal glyphs, connected marker, solid-dark cards, Bluetooth intact.173 + 6. **Live state-change ops (controller only, deliberate):** verify174 + scan refreshes the list; toggle off→on; connect to a known/open net;175 + confirm Bluetooth unaffected. Subagents MUST NOT run any state-changing176 + `iwctl` op during the build — fixtures only.178 + ## Subagent safety (bake into every workflow prompt) 180 + - Build + node-test against **fixtures only**. DO NOT execute `connect`,181 + `disconnect`, `scan`, `set-property Powered off`, or `forget` against the182 + live device during the build — a subagent dropping WiFi or powering the183 + radio off mid-run is a real failure mode.184 + - Verify the Bluetooth half still uses native `Quickshell.Bluetooth` and is185 + not refactored or broken by shared-panel edits.189 + NM / `Quickshell.Networking` (forbidden — iwd host). iwd DBus agent. VPN.190 + Wired/ethernet config. Per-network advanced settings.quickshell/nuguland/test-fixtures/iwctl/device-list-off.txt Added new file mode 100644+6 / −0 text lines
2 + [90m--------------------------------------------------------------------------------3 + [0m[1;90m Name Address Powered Adapter Mode 4 + [0m[90m--------------------------------------------------------------------------------5 + [0m wlan0 00:11:22:33:44:55 off phy0 stationquickshell/nuguland/test-fixtures/iwctl/device-list.txt Added new file mode 100644+6 / −0 text lines
2 + [90m--------------------------------------------------------------------------------3 + [0m[1;90m Name Address Powered Adapter Mode 4 + [0m[90m--------------------------------------------------------------------------------5 + [0m wlan0 00:11:22:33:44:55 on phy0 stationquickshell/nuguland/test-fixtures/iwctl/get-networks-empty.txt Added new file mode 100644+5 / −0 text lines
1 + Available networks[1;90m [0m2 + [90m--------------------------------------------------------------------------------3 + [0m[1;90m Network name Security Signal4 + [0m[90m--------------------------------------------------------------------------------quickshell/nuguland/test-fixtures/iwctl/get-networks.txt Added new file mode 100644+12 / −0 text lines
1 + Available networks[1;90m [0m2 + [90m--------------------------------------------------------------------------------3 + [0m[1;90m Network name Security Signal4 + [0m[90m--------------------------------------------------------------------------------5 + [0m [1;90m> [0m home-wifi psk **[1;90m**[0m 7 + Cafe Guest WiFi open ***[1;90m*[0m 8 + City Hotspot open ***[1;90m*[0m 9 + Reading Room open **[1;90m**[0m 10 + Neighbor 2G psk *[1;90m***[0m 11 + skynet-guest psk *[1;90m***[0m quickshell/nuguland/test-fixtures/iwctl/known-networks.txt Added new file mode 100644+7 / −0 text lines
1 + Known Networks[1;90m [0m2 + [90m--------------------------------------------------------------------------------3 + [0m[1;90m Name Security Hidden Last connected 4 + [0m[90m--------------------------------------------------------------------------------5 + [0m home-wifi-old psk Jun 8, 10:42 AM6 + home-wifi psk Jun 28, 6:12 PMquickshell/nuguland/test-fixtures/iwctl/station-show-disconnected.txt Added new file mode 100644+7 / −0 text lines
1 + Station: wlan0[1;90m [0m2 + [90m--------------------------------------------------------------------------------3 + [0m[1;90m Settable Property Value 4 + [0m[90m--------------------------------------------------------------------------------quickshell/nuguland/test-fixtures/iwctl/station-show.txt Added new file mode 100644+17 / −0 text lines
1 + Station: wlan0[1;90m [0m2 + [90m--------------------------------------------------------------------------------3 + [0m[1;90m Settable Property Value 4 + [0m[90m--------------------------------------------------------------------------------7 + Connected network home-wifi8 + IPv4 address 192.168.50.209 + IPv6 address fd00:dead:beef:0:0011:22ff:fe33:445510 + ConnectedBss 00:11:22:33:44:5513 + Security WPA2-Personal16 + ConnectedTime 43160 s