dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Reviews Compare Notes Search Review guide CI runs network: real iwd WiFi management via D-Bus (busctl --json) 6f0a827e95a6325e873293988cc67aea4a85b43f
Oliver Jan Krylow <oliver@bugabinga.net > · 29 Jun 2026
unsigned
Browse files Compare with HEAD
Replace the hollow Network.qml stub with real iwd connectivity management.
- network.js: pure shaping of iwd D-Bus replies (busctl --json=short). Parses
ObjectManager.GetManagedObjects (devices/stations/networks/known) and
Station.GetOrderedNetworks (signal+order) into view rows. No text/ANSI
parsing — JSON.parse only. 64 node assertions, ALL PASS.
- Network.qml: discovers the station device, reads state via two busctl calls,
builds the model. Writes via D-Bus method calls (Scan/Connect/Forget/
Disconnect) + Powered set-property; new secured-network connect keeps
iwctl --passphrase (needs an iwd agent for the key). selfTest 32/32.
- ConnectivityPanel: solid-dark cards (washout fix), connected highlight,
signal-strength glyphs, stateful connect flow (open/known direct, new-psk
reveals a password field). Bluetooth half (native Quickshell.Bluetooth)
untouched.
- Quickshell.Networking stays forbidden (NM-only; host runs iwd).
- IPC contract preserved: shader{}/compact.signal/wifi.enabled survive for
networkWidgetState(); select/scan/toggleWifi/forget/checkConnectivity intact.
Security: all calls use discrete argv (no sh -c); SSIDs may contain shell
metacharacters. Passphrase is a transient connect argument only — never in
stateJson/lastAction/error/logs. (iwctl --passphrase is briefly ps-visible;
acceptable on a single-user host.)
Fixtures sanitized (synthetic SSIDs/MAC/BSSID; repo pushes to GitHub).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Changed files (15) Diff layout Auto Unified Split
quickshell/nuguland/Network.qml Modified +395 / −165 text lines
1 1 import QtQuickimport QtQuick2 2 import Quickshellimport Quickshell
4 + import "network.js" as Network 7 - readonly property string hostStack : "iwd + systemd-networkd + systemd-resolved" 8 - property string error : "" 28 + property string deviceName : "" 29 + property string devicePath : "" 30 + property bool wifiEnabled : true 31 + property bool scanning : false 32 + property string lastError : "" 34 + property var managed: ({36 + property var mergedModel: []9 37 property var lastAction: ({ property var lastAction: ({11 - readonly property string nativeApi : "host stack: iwd + systemd-networkd + systemd-resolved" 12 - readonly property var boundedActions: ["scan" , "select" , "forget" , "toggle-wifi" , "check-connectivity" ]13 - readonly property bool nativeActionRoute : false 39 + property int scanRetriesLeft : 0 15 - function networkId (network) {16 - return String (network.id || network.name || network.ssid || "network" );46 + readonly property string svc : "net.connman.iwd" 47 + readonly property string ifaceStation : "net.connman.iwd.Station" 48 + readonly property string ifaceDevice : "net.connman.iwd.Device" 49 + readonly property string ifaceNetwork : "net.connman.iwd.Network" 50 + readonly property string ifaceKnown : "net.connman.iwd.KnownNetwork" 52 + function busctlCall (objectPath, iface, method) {53 + return ["busctl" , "--json=short" , "call" , svc, objectPath, iface, method];19 - function cloneNetwork (network) {21 - "id" : networkId(network),22 - "ssid" : String (network.ssid || network.name || network.id || "network" ),23 - "state" : String (network.state || (network.connected ? "connected" : "available" )),24 - "signal" : Number (network.signal ?? Math .round (Number (network.signalStrength || 0 ) * 100 )),25 - "security" : String (network.security || "unknown" ),26 - "known" : !! network.known30 - function hostNetworks () {34 - function sortedNetworks (rows) {35 - return rows.slice(0 ).sort((a, b) => {36 - const aConnected = a.state === "connected" || a.state === "Connected" || a.connected;37 - const bConnected = b.state === "connected" || b.state === "Connected" || b.connected;38 - if (aConnected !== bConnected)39 - return aConnected ? - 1 : 1 ;41 - const aKnown = !! a.known;42 - const bKnown = !! b.known;43 - if (aKnown !== bKnown)44 - return aKnown ? - 1 : 1 ;46 - return Number (b.signal || 0 ) - Number (a.signal || 0 );50 - function networks () {51 - return sortedNetworks(hostNetworks());54 - function connectivityPanelContract () {56 - "source" : "Nuguland bar popouts Network.qml plus Nuguland connections Network.qml Bluetooth.qml" ,57 - "ownedBy" : "PopoutHost.qml inline ConnectivityPanel" ,58 - "combinedConnectivityPanel" : true ,59 - "wifiToggleScanList" : true ,60 - "bluetoothToggleScanList" : true ,61 - "sortedNetworkRows" : true ,62 - "sortedDeviceRows" : true ,63 - "batteryBadges" : true ,64 - "serviceActionsOnly" : true ,65 - "rowKinds" : ["wifi-network" , "bluetooth-device" ],66 - "nativeServices" : ["Network.qml host stack" , "Bluetooth.qml" ],67 - "hostStack" : hostStack,68 - "noShellHelpers" : true 72 - function activeNetworkObject () {73 - const list = networks();74 - for (let i = 0 ; i < list.length; i++ ) if (list[i].state === "connected" || list[i].state === "Connected" || list[i].connected) {56 + function activeRow () {57 + for (var i = 0 ; i < mergedModel.length; i++ ) if (mergedModel[i].connected) {58 + return mergedModel[i];77 - for (let i = 0 ; i < list.length; i++ ) if (list[i].state === "connecting" || list[i].state === "Connecting" ) {63 + function rowForId (id) {64 + const name = String (id);65 + for (var i = 0 ; i < mergedModel.length; i++ ) if (mergedModel[i].id === name || mergedModel[i].ssid === name) {66 + return mergedModel[i];81 - "id" : "host-network" ,82 - "ssid" : "host-network" ,83 - "state" : "host-managed" ,85 - "security" : "systemd-networkd" ,90 - function knownNetworksById () {93 - const list = networks();94 - for (let i = 0 ; i < list.length; i++ ) indexed[networkId(list[i])] = cloneNetwork(list[i])102 - function scanning () {106 71 function role () { function role () {107 - const active = activeNetworkObject();108 - if (error.length > 0 )72 + if (lastError.length > 0 )109 73 return "error" ; return "error" ;112 76 return "ui.minor" ; return "ui.minor" ;114 - if (active.state === "connecting" || active.state === "Connecting" )78 + const active = activeRow();79 + if (active && active.state === "connecting" )115 80 return "warning" ; return "warning" ;117 - return active.state === "connected" || active.state === "Connected" || active.state === "host-managed" ? "ui.accent" : "ui.minor" ;82 + return active ? "ui.accent" : "ui.minor" ;87 + function buildModel (ordered) {88 + const rows = Network .networkRows(managed, ordered);89 + const station = managed.station || {91 + const connecting = station.state === "connecting" ;93 + for (var i = 0 ; i < rows.length; i++ ) {95 + const isConnecting = connecting && station.connectedNetwork === n.path;99 + "security" : n.security,100 + "securityLabel" : Network .securityLabel(n.security),102 + "signalPercent" : n.signal * 25 ,103 + "signalRole" : Network .signalRole(n.signal),104 + "signalGlyph" : Network .signalGlyph(n.signal),106 + "connected" : n.connected,107 + "needsPassphrase" : n.needsPassphrase,109 + "state" : n.connected ? "connected" : (isConnecting ? "connecting" : "available" )120 116 function stateObject () { function stateObject () {121 - const active = cloneNetwork(activeNetworkObject());117 + const active = activeRow();118 + const compactSignal = wifiEnabled && active ? active.signal * 25 : 0 ;123 - "backend" : "Network.qml" ,124 - "usesNativeQuickshellNetworking" : false ,125 - "usesHostStack" : true ,126 - "hostStack" : hostStack,127 - "nativeApi" : nativeApi,128 - "nativeBackend" : "iwd-systemd-networkd-resolved" ,129 - "nativeWifiEnabled" : wifiOn(),130 - "nativeWifiHardwareEnabled" : wifiOn(),131 - "nativeCanCheckConnectivity" : false ,132 - "nativeConnectivity" : "host-managed" ,133 - "nativeActionRoute" : nativeActionRoute,134 - "helperProcesses" : [],135 - "serviceOwnedActions" : true ,136 - "boundedActions" : boundedActions,137 - "connectivityPanelContract" : connectivityPanelContract(),138 - "scanning" : scanning(),120 + "scanning" : scanning,122 + "device" : deviceName,140 123 "wifi" : { "wifi" : {141 - "enabled" : wifiOn(),142 - "hardwareEnabled" : wifiOn()124 + "enabled" : wifiEnabled144 126 "active" : active, "active" : active,145 - "knownNetworks" : networks().map((network) => {146 - return cloneNetwork(network);148 - "knownNetworksById" : knownNetworksById(),127 + "networks" : mergedModel,128 + "knownNetworks" : mergedModel,149 129 "compact" : { "compact" : {150 130 "label" : "Network" , "label" : "Network" ,151 131 "role" : role(), "role" : role(),152 - "signal" : wifiOn() ? active.signal : 0 132 + "signal" : compactSignal154 136 "shader" : { "shader" : {155 - "kind" : "network-mini-graph" ,157 - "source" : "shaders/network-mini-graph.frag.qsb" ,158 - "priorArt" : "Shadertoy smoothstep distance-to-line graph primitives plus matrix-rain inspired packet rain" ,159 - "rateSource" : "Resources.qml" ,160 - "colors" : ["ui.accent" , "ui.focus" , "ui.minor" , "ui.backdrop" , "warning" , "error" ]162 141 "lastAction" : lastAction "lastAction" : lastAction167 146 return JSON .stringify(stateObject()); return JSON .stringify(stateObject());171 - error = "scan-owned-by-iwd" ;174 - "nativeActionRoute" : nativeActionRoute,175 - "hostStack" : hostStack153 + function selfTest () {157 + var check = function (label, got, want) {158 + const ok = JSON .stringify (got) === JSON .stringify (want);
170 + var devPath = "/net/connman/iwd/0/4" ;171 + var homePath = devPath + "/home_psk" ;172 + var fivegPath = devPath + "/fiveg_psk" ;173 + var cafePath = devPath + "/cafe_open" ;176 + objs["/net/connman/iwd/0" ] = {177 + "net.connman.iwd.Adapter" : { "Powered" : { "type" : "b" , "data" : true } }180 + "net.connman.iwd.Device" : {181 + "Name" : { "type" : "s" , "data" : "wlan0" },182 + "Powered" : { "type" : "b" , "data" : true },183 + "Mode" : { "type" : "s" , "data" : "station" }185 + "net.connman.iwd.Station" : {186 + "State" : { "type" : "s" , "data" : "connected" },187 + "Scanning" : { "type" : "b" , "data" : false },188 + "ConnectedNetwork" : { "type" : "o" , "data" : homePath }192 + "net.connman.iwd.Network" : {193 + "Name" : { "type" : "s" , "data" : "home-wifi" },194 + "Type" : { "type" : "s" , "data" : "psk" },195 + "Connected" : { "type" : "b" , "data" : true },196 + "KnownNetwork" : { "type" : "o" , "data" : "/known/home" }200 + "net.connman.iwd.Network" : {201 + "Name" : { "type" : "s" , "data" : "home-wifi-5g" },202 + "Type" : { "type" : "s" , "data" : "psk" },203 + "Connected" : { "type" : "b" , "data" : false }207 + "net.connman.iwd.Network" : {208 + "Name" : { "type" : "s" , "data" : "Cafe Guest WiFi" },209 + "Type" : { "type" : "s" , "data" : "open" },210 + "Connected" : { "type" : "b" , "data" : false }213 + var gmo = JSON .stringify ({ "type" : "a{oa{sa{sv}}}" , "data" : [objs] });214 + var gon = JSON .stringify ({216 + "data" : [[[homePath, - 6800 ], [fivegPath, - 4900 ], [cafePath, - 6500 ]]]219 + var m = Network .parseManaged(gmo);220 + check("parseManaged device" , m.device.name, "wlan0" );221 + check("parseManaged mode" , m.device.mode, "station" );222 + check("parseManaged powered" , m.device.powered, true );223 + check("parseManaged devicePath" , m.devicePath, devPath);224 + check("parseManaged state" , m.station.state, "connected" );225 + check("parseManaged home known" , m.networks[homePath].known, true );226 + check("parseManaged 5g known" , m.networks[fivegPath].known, false );228 + var ordered = Network .parseOrdered(gon);229 + check("parseOrdered length" , ordered.length, 3 );230 + check("parseOrdered first signal" , ordered[0 ].signal, - 6800 );232 + var rows = Network .networkRows(m, ordered);233 + check("networkRows length" , rows.length, 3 );234 + check("rows home ssid" , rows[0 ].ssid, "home-wifi" );235 + check("rows home signal" , rows[0 ].signal, 2 );236 + check("rows home connected" , rows[0 ].connected, true );237 + check("rows home needsPass" , rows[0 ].needsPassphrase, false );238 + check("rows home path" , rows[0 ].path, homePath);239 + check("rows 5g signal" , rows[1 ].signal, 4 );240 + check("rows 5g needsPass" , rows[1 ].needsPassphrase, true );241 + check("rows cafe ssid (spaces)" , rows[2 ].ssid, "Cafe Guest WiFi" );242 + check("rows cafe needsPass" , rows[2 ].needsPassphrase, false );244 + check("signalBars(-4900)" , Network .signalBars(- 4900 ), 4 );245 + check("signalBars(-6800)" , Network .signalBars(- 6800 ), 2 );246 + check("signalBars(NaN)" , Network .signalBars("x" ), 0 );247 + check("signalRole(0)" , Network .signalRole(0 ), "ui.minor" );248 + check("signalRole(2)" , Network .signalRole(2 ), "ui.accent" );249 + check("signalRole(4)" , Network .signalRole(4 ), "content.accent" );250 + check("securityLabel psk" , Network .securityLabel("psk" ), "WPA" );251 + check("securityLabel open" , Network .securityLabel("open" ), "Open" );252 + check("needsPassphrase open" , Network .needsPassphrase("open" , false ), false );253 + check("needsPassphrase psk unknown" , Network .needsPassphrase("psk" , false ), true );254 + check("networkId empty non-empty" , Network .networkId("" ).length > 0 , true );255 + check("signalGlyph(0) non-empty" , Network .signalGlyph(0 ).length > 0 , true );256 + check("parseManaged(null) safe" , Network .parseManaged(null ).devicePath, "" );258 + return JSON .stringify ({269 + function refresh () {270 + gmoProc.exec(["busctl" , "--json=short" , "call" , svc, "/" , "org.freedesktop.DBus.ObjectManager" , "GetManagedObjects" ]);282 + scanRetriesLeft = 2 ;283 + scanProc.exec(busctlCall(devicePath, ifaceStation, "Scan" ));177 285 return stateJson(); return stateJson();
292 + function connect (ssid, passphrase) {293 + const name = String (ssid);294 + const pp = (passphrase === undefined || passphrase === null ) ? "" : String (passphrase);295 + const row = rowForId(name);301 + if (pp.length > 0 ) {304 + actionProc.exec(["iwctl" , "--passphrase" , pp, "station" , deviceName, "connect" , name]);306 + } else if (row && row.path) {307 + actionProc.exec(busctlCall(row.path, ifaceNetwork, "Connect" ));180 313 function select (id) { function select (id) {181 - const networkIdValue = String (id);182 - const list = networks();183 - let selected = null ;184 - for (let i = 0 ; i < list.length; i++ ) if (networkId(list[i]) === networkIdValue) {188 - error = "unknown-network" ;191 - "id" : networkIdValue,192 - "nativeActionRoute" : nativeActionRoute,193 - "hostStack" : hostStack197 - error = "select-owned-by-iwd" ;314 + const name = String (id);198 315 lastAction = { lastAction = {199 316 "kind" : "select" , "kind" : "select" ,200 - "id" : networkIdValue,201 - "nativeActionRoute" : nativeActionRoute,202 - "hostStack" : hostStack
319 + return connect(name, "" );322 + function forget (id) {323 + const name = String (id);328 + const knownPath = (managed.knownBySsid || {})[name];330 + actionProc.exec(busctlCall(knownPath, ifaceKnown, "Forget" ));204 332 return stateJson(); return stateJson();207 335 function toggleWifi (enabled) { function toggleWifi (enabled) {208 - error = "wifi-toggle-owned-by-iwd" ;336 + const on = !! enabled;209 337 lastAction = { lastAction = {210 338 "kind" : "toggle-wifi" , "kind" : "toggle-wifi" ,211 - "enabled" : wifiOn(),212 - "nativeActionRoute" : nativeActionRoute,213 - "hostStack" : hostStack
343 + actionProc.exec(["busctl" , "set-property" , svc, devicePath, ifaceDevice, "Powered" , "b" , on ? "true" : "false" ]);215 345 return stateJson(); return stateJson();218 - function forget (id) {219 - const networkIdValue = String (id);348 + function disconnect () {220 349 lastAction = { lastAction = {222 - "id" : networkIdValue,223 - "nativeActionRoute" : nativeActionRoute,224 - "hostStack" : hostStack350 + "kind" : "disconnect"
353 + actionProc.exec(busctlCall(devicePath, ifaceStation, "Disconnect" ));226 355 return stateJson(); return stateJson();229 358 function checkConnectivity () { function checkConnectivity () {230 359 lastAction = { lastAction = {231 - "kind" : "check-connectivity" , 232 - "nativeActionRoute" : nativeActionRoute,233 - "hostStack" : hostStack360 + "kind" : "check-connectivity" 235 363 return stateJson(); return stateJson();
366 + Component .onCompleted: refresh ()375 + stdout : StdioCollector {378 + root.managed = Network .parseManaged(this.text);379 + const m = root.managed;380 + if (! m.device || ! m.devicePath) {381 + root.lastError = "no-wifi-device" ;382 + root.deviceName = "" ;383 + root.devicePath = "" ;384 + root.buildModel([]);387 + root.deviceName = m.device.name;388 + root.devicePath = m.devicePath;389 + root.wifiEnabled = m.device.powered;390 + root.lastError = "" ;391 + if (m.device.powered) {392 + gonProc.exec(root.busctlCall(m.devicePath, root.ifaceStation, "GetOrderedNetworks" ));394 + root.buildModel([]);406 + stdout : StdioCollector {409 + root.buildModel(Network .parseOrdered(this.text));422 + stderr : StdioCollector {430 + onExited : (exitCode, exitStatus) => {431 + const err = String (scanErr.text || "" );432 + if (exitCode !== 0 && err.indexOf("already in progress" ) < 0 )433 + root.lastError = "scan-failed" ;446 + onExited : (exitCode, exitStatus) => {460 + root.scanRetriesLeft -= 1 ;461 + if (root.scanRetriesLeft <= 0 ) {462 + root.scanning = false ;quickshell/nuguland/PopoutHost.qml Modified +238 / −41 text lines
2663 2663 required property QtObject networkService required property QtObject networkService2664 2664 required property QtObject bluetoothService required property QtObject bluetoothService2665 2665 property var networkState: networkService ? Util .parseJson(networkService.stateJson(), { property var networkState: networkService ? Util .parseJson(networkService.stateJson(), {2666 2667 "knownNetworks" : [], "knownNetworks" : [],2667 - "connectivityPanelContract" : {
2669 2668 "wifi" : { "wifi" : {2672 2674 "knownNetworks" : [], "knownNetworks" : [],2673 - "connectivityPanelContract" : {
2675 2675 "wifi" : { "wifi" : {2678 2680 property var bluetoothState: bluetoothService ? Util .parseJson(bluetoothService.stateJson(), { property var bluetoothState: bluetoothService ? Util .parseJson(bluetoothService.stateJson(), {2684 2686 "adapter" : { "adapter" : {2687 - readonly property var panel: networkState.connectivityPanelContract || ({2692 + property string expandedSsid: "" 2691 2694 function refreshNetwork (text) { function refreshNetwork (text) {2692 2695 networkState = Util .parseJson(text, networkState); networkState = Util .parseJson(text, networkState);
2729 + function connectSecured (ssid, passphrase) {2730 + if (networkService)2731 + refreshNetwork(networkService.connect(ssid, passphrase));2723 2735 function toggleBluetooth () { function toggleBluetooth () {2724 2736 if (bluetoothService) if (bluetoothService)2725 2737 refreshBluetooth(bluetoothService.toggle(! (bluetoothState.adapter && bluetoothState.adapter.state === "powered" ))); refreshBluetooth(bluetoothService.toggle(! (bluetoothState.adapter && bluetoothState.adapter.state === "powered" )));2751 2763 if (role === "ui.minor" ) if (role === "ui.minor" )2752 2764 return theme.ui.minor; return theme.ui.minor;
2766 + if (role === "content.accent" )2767 + return theme.content.accent;2754 2769 return theme.ui.accent; return theme.ui.accent;2757 2772 spacing: 10 spacing: 10 2758 2773 width: parent ? parent.width : 0 width: parent ? parent.width : 0
2779 + target : root.networkService2781 + function onRefreshed () {2782 + if (root.networkService)2783 + root.refreshNetwork(root.networkService.stateJson());2761 2789 objectName : "networkRateRow" objectName : "networkRateRow" 2762 2790 width : parent.width width : parent.width2841 2869 Repeater { Repeater {2842 - model : root.networkState.knownNetworks || []2870 + model : root.networkState.networks || []2844 - delegate : Rectangle {2845 2873 id : wifiRow id : wifiRow2847 2875 required property var modelData required property var modelData2848 - readonly property bool active : modelData.state === " connected" || modelData . state === " Connected " 2876 + readonly property bool active : modelData.connected === true 2877 + readonly property bool revealed : root.expandedSsid === modelData.ssid2850 2879 width : root.width width : root.width2853 - color : root.theme ? root.theme.withAlpha(active ? root.theme.ui.focus : root.theme.ui.minor, active ? 0.24 : 0.1 ) : "transparent" 2855 - border.color: root.roleColor(active ? "ui.accent" : modelData.state === "connecting" ? "warning" : "ui.minor" )2858 - anchors.left: parent.left2859 - anchors.leftMargin: 8 2860 - anchors.verticalCenter: parent.verticalCenter2862 - text : wifiRow.modelData.ssid2863 - width : parent.width - 122 2864 - elide : Text .ElideRight2885 + width : parent.width2888 + color : root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, wifiRow.active ? 0.82 : 0.55 ) : "#333333" 2889 + border.width: wifiRow.active ? 2 : 1 2890 + border.color: root.theme ? (wifiRow.active ? root.theme.ui.accent : (wifiRow.modelData.state === "connecting" ? root.roleColor("warning" ) : root.theme.withAlpha(root.theme.ui.minor, 0.45 ))) : "white" 2868 - anchors.right: parent.right2869 - anchors.rightMargin: 8 2870 - anchors.verticalCenter: parent.verticalCenter2873 - text : ` ${wifiRow.modelData.signal}% ${wifiRow.modelData.security}` 2877 - anchors.fill: parent2878 - acceptedButtons : Qt .LeftButton | Qt .MiddleButton2879 - onClicked : (event) => {2880 - if (event.button === Qt .MiddleButton)2881 - root.forgetNetwork(wifiRow.modelData.id);2883 - root.selectNetwork(wifiRow.modelData.id);2894 + anchors.left: parent.left2895 + anchors.top: parent.top2896 + anchors.bottom: parent.bottom2900 + color : root.theme ? root.theme.ui.accent : "transparent" 2901 + opacity : wifiRow.active ? 1 : 0
2907 + anchors.left: parent.left2908 + anchors.leftMargin: 12 2909 + anchors.verticalCenter: parent.verticalCenter2910 + font.family: "Symbols Nerd Font Mono" 2912 + text : wifiRow.modelData.signalGlyph || "" 2913 + color : root.roleColor(wifiRow.modelData.signalRole || "ui.minor" )2919 + anchors.right: parent.right2920 + anchors.rightMargin: 10 2921 + anchors.verticalCenter: parent.verticalCenter2925 + color : root.theme ? root.theme.withAlpha(wifiRow.active ? root.theme.error : root.theme.ui.accent, wifiRow.revealed ? 0.34 : 0.18 ) : "transparent" 2927 + border.color: root.theme ? root.theme.withAlpha(wifiRow.active ? root.theme.error : root.theme.ui.accent, 0.7 ) : "white" 2930 + anchors.centerIn: parent2933 + text : wifiRow.active ? "forget" : (wifiRow.modelData.needsPassphrase ? (wifiRow.revealed ? "cancel" : "connect" ) : "connect" )2937 + anchors.fill: parent2939 + if (wifiRow.active) {2940 + root.expandedSsid = "" ;2941 + root.forgetNetwork(wifiRow.modelData.id);2942 + } else if (wifiRow.modelData.needsPassphrase) {2943 + root.expandedSsid = wifiRow.revealed ? "" : wifiRow.modelData.ssid;2945 + root.expandedSsid = "" ;2946 + root.selectNetwork(wifiRow.modelData.id);2956 + anchors.right: wifiAction.left2957 + anchors.rightMargin: 10 2958 + anchors.verticalCenter: parent.verticalCenter2961 + text : wifiRow.active ? "connected" : (wifiRow.modelData.securityLabel || "" )2962 + color : root.roleColor(wifiRow.active ? "content.accent" : "ui.minor" )2966 + anchors.left: wifiGlyph.right2967 + anchors.leftMargin: 10 2968 + anchors.right: wifiLabel.left2969 + anchors.rightMargin: 10 2970 + anchors.verticalCenter: parent.verticalCenter2972 + text : wifiRow.modelData.ssid2973 + elide : Text .ElideRight2984 + function submit () {2985 + root.connectSecured(wifiRow.modelData.ssid, wifiPp.text);2987 + root.expandedSsid = "" ;2990 + visible : wifiRow.revealed2991 + width : parent.width2992 + height : visible ? 34 : 0 2994 + color : root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.7 ) : "#333333" 2996 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.6 ) : "white" 2997 + onVisibleChanged : {2999 + Qt .callLater(function () {3000 + wifiPp.forceActiveFocus();3007 + anchors.left: parent.left3008 + anchors.leftMargin: 12 3009 + anchors.right: wifiPpConfirm.left3010 + anchors.rightMargin: 10 3011 + anchors.verticalCenter: parent.verticalCenter3012 + verticalAlignment : TextInput .AlignVCenter3013 + color : root.theme ? root.theme.content.normal : "white" 3014 + selectionColor : root.theme ? root.theme.ui.focus : "#ffffff" 3015 + selectedTextColor : root.theme ? root.theme.content.backdrop : "black" 3016 + font.family: "IBM Plex Sans" 3018 + echoMode : TextInput .Password3020 + onAccepted : wifiPpRow.submit()3021 + Keys .onReturnPressed: (event) => {3022 + event.accepted = true ;3023 + wifiPpRow.submit();3025 + Keys .onEnterPressed: (event) => {3026 + event.accepted = true ;3027 + wifiPpRow.submit();3029 + Keys .onEscapePressed: (event) => {3030 + event.accepted = true ;3032 + root.expandedSsid = "" ;3037 + anchors.left: parent.left3038 + anchors.leftMargin: 12 3039 + anchors.verticalCenter: parent.verticalCenter3040 + visible : wifiPp.text.length === 0 3050 + anchors.right: parent.right3051 + anchors.rightMargin: 6 3052 + anchors.verticalCenter: parent.verticalCenter3056 + color : root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.22 ) : "transparent" 3058 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7 ) : "white" 3061 + anchors.centerIn: parent3068 + anchors.fill: parent3069 + onClicked : wifiPpRow.submit()
3081 + visible : !! (root.networkState.wifi && root.networkState.wifi.enabled) && (! root.networkState.networks || root.networkState.networks.length === 0 )3084 + text : root.networkState.scanning ? "scanning…" : "no networks" 2893 3090 Rectangle { Rectangle {quickshell/nuguland/docs/superpowers/specs/2026-06-29-network-popup-redesign-design.md Modified +79 / −64 text lines
1 1 # Network (Connectivity) Popup Redesign # Network (Connectivity) Popup Redesign 3 3 **Date:** 2026-06-29**Date:** 2026-06-294 - **Status:** approved (autonomous — standing /goal "ultracode next are audio, bright, networn and power")5 - **Popup:** 3 of 4 (audio ✅, brightness ✅, network ▶, power ⏳)4 + **Status:** shipped (autonomous — standing /goal "ultracode next are audio, bright, networn and power")5 + **Popup:** 3 of 4 (audio ✅, brightness ✅, network ✅, power ⏳)7 + > **PIVOT (post-build):** the read path was first built on `iwctl` ANSI-table8 + > parsing (worked, verified live). The user asked whether iwd has a9 + > machine-readable interface — it does: the **iwd D-Bus API** (`net.connman.iwd`),10 + > and `busctl --json=short` emits clean JSON against it. We pivoted the read11 + > path (and most writes) to D-Bus JSON, deleting ~150 lines of fragile12 + > ANSI/fixed-column parsing (matches the standing directive "rely on APIs more13 + > than custom code, the less code the better"). The sections below are updated14 + > to the **as-shipped D-Bus design**; the earlier iwctl approach is noted where15 + > still relevant (the one new-secured-network connect keeps `iwctl --passphrase`).26 36 | Layer | File | Responsibility || Layer | File | Responsibility |27 37 |-------|------|----------------||-------|------|----------------|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. |38 + | Pure logic | `network.js` | `JSON.parse ` busctl D-Bus replies → plain data; shape/role/label. NO I/O. Dual-mode export (node tests + QML import), like `clip.js`/`audio.js`/`brightness.js`. |39 + | Service (native boundary) | `Network.qml` | Spawn `busctl ` (and ` iwctl` for one case) via `Process`, feed stdout to `network.js`, hold model + cadence, expose IPC. |30 40 | View | `PopoutHost.qml` ConnectivityPanel | Pure graphical — WiFi list + connect flow + toggle; Bluetooth half unchanged. || 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.42 + **Native boundary rule:** native objects (`Process`, ` Quickshell.Bluetooth ` ) 43 + stay in QML. Only pure JSON shaping moves to `network.js` as plain-data38 - ## iwctl command surface 46 + ## D-Bus command surface (`busctl --json=short`) 40 - Device name is **discovered** (`iwctl device list` → first `station`-mode41 - device), never hardcoded `wlan0`.48 + iwd object service is `net.connman.iwd` (system bus). Device path is49 + **discovered** from `GetManagedObjects` (first `net.connman.iwd.Device` with50 + `Mode == "station"`), never hardcoded `wlan0`. Network/known objects carry the51 + SSID hex-encoded in their path, but `Name` is already decoded.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> disconnect54 + read all: busctl --json=short call net.connman.iwd / \55 + org.freedesktop.DBus.ObjectManager GetManagedObjects56 + read signal: busctl --json=short call net.connman.iwd <dev> \57 + net.connman.iwd.Station GetOrderedNetworks # [[path,dBm*100],…] sorted58 + scan(async): busctl --json=short call net.connman.iwd <dev> net.connman.iwd.Station Scan59 + connect: busctl --json=short call net.connman.iwd <netPath> net.connman.iwd.Network Connect60 + forget: busctl --json=short call net.connman.iwd <knownPath> net.connman.iwd.KnownNetwork Forget61 + disconnect: busctl --json=short call net.connman.iwd <dev> net.connman.iwd.Station Disconnect62 + toggle wifi: busctl set-property net.connman.iwd <dev> net.connman.iwd.Device Powered b true|false63 + connect NEW psk (hybrid): iwctl --passphrase <pp> station <devName> connect <ssid>
66 + **Why the one `iwctl` hold-out:** `Network.Connect` over D-Bus on a *new*67 + secured network makes iwd call back to a registered **agent** for the68 + passphrase. Exporting a D-Bus agent object from QML is impractical, so for69 + that single case we use `iwctl --passphrase` (iwctl registers its own agent).70 + Open and **known** networks connect over pure D-Bus (no agent needed — open71 + has no secret; known has iwd's stored PSK).56 73 ### Async scan (must not look broken) ### 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** a 63 - hard error → keep `scanning=true`, don't surface as error .75 + `Station.Scan` returns immediately; the network list lags ~1–4 s. So:76 + - `scan()` sets a real `scanning` state, calls ` Scan ` , then re-reads on a 77 + delayed/polled Timer (≈2 s, a couple of retries).78 + - A scan that errors with " already in progress" = scan-in-progress, **not**79 + a hard error → keep `scanning=true`.65 - ## `network.js` — pure parser API (node-tested against fixtures) 81 + ## `network.js` — pure shaping API (node-tested against JSON 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`).83 + Fixtures: `test-fixtures/iwd/*.json` (real busctl `--json=short` replies,84 + **sanitized** — synthetic SSIDs/MAC/BSSID, structure preserved):85 + `get-managed-objects.json`, `ordered-networks.json`.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 }]88 + unwrap(raw) -> peels busctl's { type, data:[value] } wrapper89 + prop(iface, name, fb) -> a D-Bus { type, data } property value, or fb90 + signalBars(centiDbm) -> 0..4 (dBm*100 thresholds: ≥-60→4, ≥-67→3, ≥-74→2, else 1; NaN→0)91 + parseManaged(rawGmo) -> { devicePath, device:{name,powered,mode},92 + station:{state,scanning,connectedNetwork},93 + networks:{ <path>:{ssid,security,connected,known} },94 + knownBySsid:{ <ssid>:<knownPath> } }95 + parseOrdered(rawGon) -> [{ path, signal:centiDbm }] in iwd order96 + networkRows(managed, ordered) -> joined view rows, iwd order:97 + [{ id, ssid, security, signal:0..4, connected, known, needsPassphrase, path }]79 100 Shaping / view helpers (pure):Shaping / view helpers (pure):81 - mergeNetworks(networks, known, station) -> enrich each net:82 - { ...net, known:bool, connected:bool, needsPassphrase:bool }
83 102 needsPassphrase(security, known) -> security!=="open" && !knownneedsPassphrase(security, known) -> security!=="open" && !known84 103 signalRole(bars) -> "ui.minor" (≤1) | "ui.accent" (2–3) | "content.accent" (4)signalRole(bars) -> "ui.minor" (≤1) | "ui.accent" (2–3) | "content.accent" (4)85 104 signalGlyph(bars) -> nerd-font wifi glyph by strengthsignalGlyph(bars) -> nerd-font wifi glyph by strength86 - securityLabel(sec) -> "open" -> "Open", "psk" -> "WPA", "8021x" -> "Enterprise"105 + securityLabel(sec) -> "open"→ "Open", "psk"→ "WPA", "8021x"→ "Enterprise"87 106 networkId(ssid) -> stable id (ssid itself; never empty)networkId(ssid) -> stable id (ssid itself; never empty)88 - sortNetworks(list) -> connected first, then signal desc, then ssid asc
91 - ### Parser correctness facts (bake into tests) 109 + ### Correctness facts (baked 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).111 + - **`known`** = the per-network `KnownNetwork` D-Bus property is **present**112 + (iwd omits it when the net isn't known) — no name-join needed.113 + - **Order** comes from `GetOrderedNetworks` (iwd already lists the connected114 + net first, then by descending strength) — no client-side re-sort.115 + - **`networkRows` carries `path`** so the service calls `Connect` on the exact116 + D-Bus object (no ssid→path guessing); `forget` uses `knownBySsid[ssid]`.117 + - **Names with spaces** (`Cafe Guest WiFi`) arrive decoded in `Name` — verbatim.118 + - **Robustness:** malformed/empty replies must not throw — `unwrap` of empty119 + `data:[]`→null; `parseManaged(null)`/`parseOrdered(null)` return empty;120 + an ordered path with no matching managed network is skipped.108 - `network.test.js` prints `network.test.js: ALL PASS`, asserts the specific 109 - rows above + every edge fixture.122 + `network.test.js` prints `network.test.js: ALL PASS` (64 assertions). 111 124 ## `Network.qml` — service ## `Network.qml` — service 113 126 - Replace all stub bodies with real `Process`-driven impls.- 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.127 + - `refresh()`: one `GetManagedObjects` call (discovers device path + all128 + state) → `parseManaged`; if powered, follow with `GetOrderedNetworks` →129 + `parseOrdered` → `networkRows` → model (`buildModel` decorates with130 + label/percent/glyph/role/state).131 + - `scan()`: ` Station.Scan ` , set `scanning`, delayed re-`refresh()`.132 + - `connect(ssid, passphrase)` (open/known via D-Bus `Network.Connect`,133 + new-psk via `iwctl --passphrase`), `forget(ssid)` (`KnownNetwork.Forget`),134 + `toggleWifi(on)` (`Device.Powered` set-property), `disconnect()` — all real.120 135 - Preserve the IPC contract (consumed by `shell.qml` IpcHandlers /- Preserve the IPC contract (consumed by `shell.qml` IpcHandlers /121 136 `stateJson`): `stateJson`, `scan`, `select`/`connect`, `toggleWifi`, `stateJson`): `stateJson`, `scan`, `select`/`connect`, `toggleWifi`,122 137 `forget`, `checkConnectivity`. Add `selfTest()` (runs parser over fixtures `forget`, `checkConnectivity`. Add `selfTest()` (runs parser over fixturesquickshell/nuguland/network.js Added new file mode 100644+208 / −0 text lines
15 + function unwrap (raw) {16 + if (raw === undefined || raw === null ) return null ;17 + var obj = typeof raw === "string" ? JSON .parse (raw) : raw;18 + if (obj && Object .prototype .hasOwnProperty .call(obj, "data" )19 + && Array .isArray (obj.data)) {20 + return obj.data.length > 0 ? obj.data[0 ] : null ;26 + function prop (iface, name, fb) {27 + if (iface && iface[name] && iface[name].data !== undefined ) return iface[name].data;35 + function signalBars (centiDbm) {36 + var v = Number (centiDbm);37 + if (! isFinite (v)) return 0 ;38 + if (v >= - 6000 ) return 4 ;39 + if (v >= - 6700 ) return 3 ;40 + if (v >= - 7400 ) return 2 ;52 + function parseManaged (rawGmo) {53 + var d = unwrap(rawGmo) || {};61 + for (var path in d) {62 + if (! Object .prototype .hasOwnProperty .call(d, path)) continue ;63 + var ifaces = d[path];65 + var dev = ifaces["net.connman.iwd.Device" ];66 + if (dev && prop(dev, "Mode" , "" ) === "station" && out.devicePath === "" ) {67 + out.devicePath = path;69 + name: prop(dev, "Name" , "" ),70 + powered: !! prop(dev, "Powered" , false ),73 + var st = ifaces["net.connman.iwd.Station" ];76 + state: prop(st, "State" , "" ),77 + scanning: !! prop(st, "Scanning" , false ),78 + connectedNetwork: prop(st, "ConnectedNetwork" , "" )83 + var net = ifaces["net.connman.iwd.Network" ];85 + out.networks[path] = {86 + ssid: prop(net, "Name" , "" ),87 + security: prop(net, "Type" , "" ),88 + connected: !! prop(net, "Connected" , false ),90 + known: Object .prototype .hasOwnProperty .call(net, "KnownNetwork" )94 + var kn = ifaces["net.connman.iwd.KnownNetwork" ];96 + var kssid = prop(kn, "Name" , "" );97 + if (kssid !== "" ) out.knownBySsid[kssid] = path;105 + function parseOrdered (rawGon) {106 + var arr = unwrap(rawGon);108 + if (! Array .isArray (arr)) return out;109 + for (var i = 0 ; i < arr.length; i++ ) {111 + if (! Array .isArray (pair) || pair.length < 2 ) continue ;112 + out.push({ path: pair[0 ], signal: pair[1 ] });121 + function networkRows (managed, ordered) {122 + var nets = (managed && managed.networks) ? managed.networks : {};123 + var list = ordered || [];125 + for (var i = 0 ; i < list.length; i++ ) {127 + var n = nets[o.path];130 + id: networkId(n.ssid),132 + security: n.security,133 + signal: signalBars(o.signal),134 + connected: n.connected,136 + needsPassphrase: needsPassphrase(n.security, n.known),146 + function needsPassphrase (security, known) {147 + return security !== "open" && ! known;151 + function signalRole (bars) {152 + if (bars <= 1 ) return "ui.minor" ;153 + if (bars <= 3 ) return "ui.accent" ;154 + return "content.accent" ;159 + function fromCodePoint (n) {160 + if (n < 0x10000 ) return String .fromCharCode (n);161 + var c = n - 0x10000 ;162 + return String .fromCharCode (0xD800 + (c >> 10 ), 0xDC00 + (c & 0x3FF ));165 + fromCodePoint(0xF092F ), 166 + fromCodePoint(0xF091F ), 167 + fromCodePoint(0xF0922 ), 168 + fromCodePoint(0xF0925 ), 169 + fromCodePoint(0xF0928 ) 173 + function signalGlyph (bars) {177 + return WIFI_GLYPHS [b];181 + function securityLabel (sec) {182 + if (sec === "open" ) return "Open" ;183 + if (sec === "psk" ) return "WPA" ;184 + if (sec === "8021x" ) return "Enterprise" ;185 + return sec ? sec : "" ;189 + function networkId (ssid) {190 + var s = (ssid === undefined || ssid === null ) ? "" : String (ssid);191 + return s.length > 0 ? s : "hidden-network" ;194 + if (typeof module !== 'undefined' && module .exports ) {198 + signalBars: signalBars,199 + parseManaged: parseManaged,200 + parseOrdered: parseOrdered,201 + networkRows: networkRows,202 + needsPassphrase: needsPassphrase,203 + signalRole: signalRole,204 + signalGlyph: signalGlyph,205 + securityLabel: securityLabel,206 + networkId: networkIdquickshell/nuguland/network.test.js Added new file mode 100644+112 / −0 text lines
3 + var assert = require ('assert' );4 + var fs = require ('fs' );5 + var path = require ('path' );6 + var N = require ('./network.js' );8 + var FIX = path.join(__dirname , 'test-fixtures' , 'iwd' );9 + function fixture (name) { return fs.readFileSync(path.join(FIX, name), 'utf8' ); }12 + function eq (got, want, msg) { assert.strictEqual(got, want, msg); passed++ ; }13 + function ok (cond, msg) { assert(cond, msg); passed++ ; }15 + var GMO = fixture('get-managed-objects.json' );16 + var GON = fixture('ordered-networks.json' );19 + eq(N .unwrap('{"type":"u","data":[42]}' ), 42 , 'unwrap pulls the single payload' );20 + eq(N .unwrap('{"type":"a","data":[]}' ), null , 'unwrap of empty data => null' );21 + eq(N .unwrap(null ), null , 'unwrap(null) => null' );24 + eq(N .signalBars(- 4900 ), 4 , '-49 dBm => 4 bars' );25 + eq(N .signalBars(- 6000 ), 4 , '-60 dBm boundary => 4 bars' );26 + eq(N .signalBars(- 6500 ), 3 , '-65 dBm => 3 bars' );27 + eq(N .signalBars(- 6800 ), 2 , '-68 dBm => 2 bars' );28 + eq(N .signalBars(- 8400 ), 1 , '-84 dBm => 1 bar' );29 + eq(N .signalBars(- 10000 ), 1 , 'very weak => 1 bar (never 0 for a listed net)' );30 + eq(N .signalBars('not-a-number' ), 0 , 'non-finite => 0 bars' );33 + var managed = N .parseManaged(GMO);34 + ok(/\/0\/4 $ / .test(managed.devicePath), 'devicePath is the station device object' );35 + eq(managed.device.name, 'wlan0' , 'device name discovered (not hardcoded)' );36 + eq(managed.device.powered, true , 'device powered' );37 + eq(managed.device.mode, 'station' , 'device mode station' );38 + eq(managed.station.state, 'connected' , 'station state connected' );39 + eq(managed.station.scanning, false , 'station not scanning' );40 + ok(/686f6d652d77696669_psk $ / .test(managed.station.connectedNetwork), 'connectedNetwork is home-wifi path' );41 + eq(Object .keys (managed.networks).length, 11 , 'eleven networks in managed objects' );42 + ok('home-wifi' in managed.knownBySsid, 'home-wifi is a known network' );43 + ok('home-wifi-old' in managed.knownBySsid, 'home-wifi-old known (not currently in scan)' );44 + eq(Object .keys (managed.knownBySsid).length, 2 , 'exactly two known networks' );47 + var ordered = N .parseOrdered(GON);48 + eq(ordered.length, 11 , 'eleven ordered networks' );49 + eq(ordered[0 ].signal, - 6800 , 'first ordered net signal = -6800 (connected first)' );50 + ok(/686f6d652d77696669_psk $ / .test(ordered[0 ].path), 'first ordered path is home-wifi' );53 + var rows = N .networkRows(managed, ordered);54 + eq(rows.length, 11 , 'eleven view rows' );55 + function row (ssid) { return rows.filter(function (r) { return r.ssid === ssid; })[0 ] || null ; }57 + var home = row('home-wifi' );58 + ok(home !== null , 'home-wifi present' );59 + eq(home.signal, 2 , 'home-wifi 2 bars' );60 + eq(home.connected, true , 'home-wifi connected' );61 + eq(home.known, true , 'home-wifi known' );62 + eq(home.needsPassphrase, false , 'connected/known net needs no passphrase' );63 + ok(typeof home.path === 'string' && home.path.length > 0 , 'row carries D-Bus object path' );65 + var fiveg = row('home-wifi-5g' );66 + eq(fiveg.signal, 4 , 'home-wifi-5g 4 bars' );67 + eq(fiveg.known, false , 'home-wifi-5g not known' );68 + eq(fiveg.needsPassphrase, true , 'unknown psk net needs passphrase' );70 + var cafe = row('Cafe Guest WiFi' );71 + ok(cafe !== null , 'spaced SSID "Cafe Guest WiFi" preserved verbatim' );72 + eq(cafe.signal, 3 , 'Cafe Guest WiFi 3 bars' );74 + var city = row('City Hotspot' );75 + ok(city !== null , 'open spaced SSID "City Hotspot" present' );76 + eq(city.security, 'open' , 'City Hotspot is open' );77 + eq(city.needsPassphrase, false , 'open net needs no passphrase' );79 + eq(rows[0 ].ssid, 'home-wifi' , 'iwd order preserved: connected network first' );82 + var emptyManaged = N .parseManaged('{"type":"a{oa{sa{sv}}}","data":[{}]}' );83 + eq(emptyManaged.devicePath, '' , 'no device => empty devicePath' );84 + eq(emptyManaged.device, null , 'no device => null' );85 + eq(emptyManaged.station, null , 'no station => null' );86 + eq(Object .keys (emptyManaged.networks).length, 0 , 'no networks => empty' );87 + eq(N .parseManaged(null ).devicePath, '' , 'parseManaged(null) safe' );88 + eq(N .parseOrdered(null ).length, 0 , 'parseOrdered(null) => []' );89 + eq(N .parseOrdered('{"type":"a(on)","data":[[]]}' ).length, 0 , 'empty ordered => []' );90 + eq(N .networkRows({ networks: {} }, []).length, 0 , 'no rows from empty inputs' );92 + eq(N .networkRows({ networks: {} }, [{ path: '/ghost' , signal: - 5000 }]).length, 0 , 'orphan ordered path skipped' );95 + eq(N .signalRole(0 ), 'ui.minor' , 'role weak' );96 + eq(N .signalRole(1 ), 'ui.minor' , 'role 1 bar weak' );97 + eq(N .signalRole(2 ), 'ui.accent' , 'role medium' );98 + eq(N .signalRole(3 ), 'ui.accent' , 'role 3 medium' );99 + eq(N .signalRole(4 ), 'content.accent' , 'role strong' );100 + eq(N .securityLabel('psk' ), 'WPA' , 'psk label' );101 + eq(N .securityLabel('open' ), 'Open' , 'open label' );102 + eq(N .securityLabel('8021x' ), 'Enterprise' , 'enterprise label' );103 + eq(N .needsPassphrase('open' , false ), false , 'open never needs passphrase' );104 + eq(N .needsPassphrase('psk' , true ), false , 'known psk needs no passphrase' );105 + eq(N .needsPassphrase('psk' , false ), true , 'unknown psk needs passphrase' );106 + eq(N .networkId('home-wifi' ), 'home-wifi' , 'networkId is the ssid' );107 + ok(N .networkId('' ).length > 0 , 'networkId never empty' );108 + ok(N .signalGlyph(0 ).length > 0 , 'glyph 0 non-empty' );109 + ok(N .signalGlyph(4 ).length > 0 , 'glyph 4 non-empty' );111 + console .log (passed + ' assertions passed' );112 + console .log ('network.test.js: ALL PASS' );quickshell/nuguland/shell.qml Modified +4 / −0 text lines
1006 1006 return network.stateJson(); return network.stateJson();
1009 + function networkSelfTest () : string {1010 + return network.selfTest();1009 1013 function networkWidgetState () : string { function networkWidgetState () : string {1010 1014 const state = JSON .parse (network.stateJson()); const state = JSON .parse (network.stateJson());1011 1015 state.barLabel = "network" ; state.barLabel = "network" ;quickshell/nuguland/test-fixtures/iwctl/device-list-off.txt Deleted deleted file mode 100644+0 / −6 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 station
quickshell/nuguland/test-fixtures/iwctl/device-list.txt Deleted deleted file mode 100644+0 / −6 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 station
quickshell/nuguland/test-fixtures/iwctl/get-networks-empty.txt Deleted deleted file mode 100644+0 / −5 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 Deleted deleted file mode 100644+0 / −12 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 Deleted deleted file mode 100644+0 / −7 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 PM
quickshell/nuguland/test-fixtures/iwctl/station-show-disconnected.txt Deleted deleted file mode 100644+0 / −7 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 Deleted deleted file mode 100644+0 / −17 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
quickshell/nuguland/test-fixtures/iwd/get-managed-objects.json Added new file mode 100644+1 / −0 text lines
1 + {"type" :"a{oa{sa{sv}}}" ,"data" :[{"/" :{"org.freedesktop.DBus.ObjectManager" :{}},"/net/connman/iwd" :{"net.connman.iwd.Daemon" :{},"org.freedesktop.DBus.Properties" :{},"net.connman.iwd.AgentManager" :{},"net.connman.iwd.p2p.ServiceManager" :{}},"/net/connman/iwd/0" :{"net.connman.iwd.Adapter" :{"Powered" :{"type" :"b" ,"data" :true },"Model" :{"type" :"s" ,"data" :"Centrino Advanced-N 6205 [Taylor Peak] (Centrino Advanced-N 6205 (802.11a/b/g/n))" },"Vendor" :{"type" :"s" ,"data" :"Intel Corporation" },"Name" :{"type" :"s" ,"data" :"phy0" },"SupportedModes" :{"type" :"as" ,"data" :["ad-hoc" ,"station" ,"ap" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4" :{"net.connman.iwd.Device" :{"Name" :{"type" :"s" ,"data" :"wlan0" },"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:04" },"Powered" :{"type" :"b" ,"data" :true },"Adapter" :{"type" :"o" ,"data" :"/net/connman/iwd/0" },"Mode" :{"type" :"s" ,"data" :"station" }},"org.freedesktop.DBus.Properties" :{},"net.connman.iwd.Station" :{"ConnectedNetwork" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4/686f6d652d77696669_psk" },"ConnectedAccessPoint" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4/686f6d652d77696669_psk/00aabbccdd05" },"Scanning" :{"type" :"b" ,"data" :false },"State" :{"type" :"s" ,"data" :"connected" },"Affinities" :{"type" :"ao" ,"data" :[]}},"net.connman.iwd.SimpleConfiguration" :{},"net.connman.iwd.DeviceProvisioning" :{"Started" :{"type" :"b" ,"data" :false }},"net.connman.iwd.SharedCodeDeviceProvisioning" :{"Started" :{"type" :"b" ,"data" :false }},"net.connman.iwd.StationDiagnostic" :{}},"/net/connman/iwd/0/4/6f322d53706f742d31323334_psk" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"o2-Spot-1234" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"psk" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/6f322d53706f742d31323334_psk/00aabbccdd03" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/6f322d53706f742d31323334_psk/00aabbccdd03" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:03" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/736b796e65742d6775657374_psk" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"skynet-guest" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"psk" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/736b796e65742d6775657374_psk/00aabbccdd00" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/736b796e65742d6775657374_psk/00aabbccdd00" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:00" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/4e65696768626f72203247_psk" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"Neighbor 2G" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"psk" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/4e65696768626f72203247_psk/00aabbccdd04" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/4e65696768626f72203247_psk/00aabbccdd04" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:05" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/636166652d636f726e6572_psk" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"cafe-corner" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"psk" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/636166652d636f726e6572_psk/00aabbccdd01" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/636166652d636f726e6572_psk/00aabbccdd01" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:01" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/52656164696e6720526f6f6d_open" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"Reading Room" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"open" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/52656164696e6720526f6f6d_open/00aabbccdd0a" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/52656164696e6720526f6f6d_open/00aabbccdd0a" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:0b" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/4369747920486f7473706f74_open" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"City Hotspot" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"open" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/4369747920486f7473706f74_open/00aabbccdd0b" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/4369747920486f7473706f74_open/00aabbccdd0b" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:0c" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/6f66666963652d77696669_psk" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"office-wifi" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"psk" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/6f66666963652d77696669_psk/00aabbccdd09" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/6f66666963652d77696669_psk/00aabbccdd09" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:0a" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/436166652047756573742057694669_psk" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"Cafe Guest WiFi" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"psk" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/436166652047756573742057694669_psk/00aabbccdd02" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/436166652047756573742057694669_psk/00aabbccdd02" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:02" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/686f6d652d776966692d3567_psk" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"home-wifi-5g" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"psk" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/686f6d652d776966692d3567_psk/00aabbccdd06" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/686f6d652d776966692d3567_psk/00aabbccdd06" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:07" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/67756573742d6e6574_psk" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"guest-net" },"Connected" :{"type" :"b" ,"data" :false },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"psk" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/67756573742d6e6574_psk/00aabbccdd07" ,"/net/connman/iwd/0/4/67756573742d6e6574_psk/00aabbccdd08" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/67756573742d6e6574_psk/00aabbccdd08" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:09" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/67756573742d6e6574_psk/00aabbccdd07" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:08" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/686f6d652d77696669_psk" :{"net.connman.iwd.Network" :{"Name" :{"type" :"s" ,"data" :"home-wifi" },"Connected" :{"type" :"b" ,"data" :true },"Device" :{"type" :"o" ,"data" :"/net/connman/iwd/0/4" },"Type" :{"type" :"s" ,"data" :"psk" },"KnownNetwork" :{"type" :"o" ,"data" :"/net/connman/iwd/686f6d652d77696669_psk" },"ExtendedServiceSet" :{"type" :"ao" ,"data" :["/net/connman/iwd/0/4/686f6d652d77696669_psk/00aabbccdd05" ]}},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/0/4/686f6d652d77696669_psk/00aabbccdd05" :{"net.connman.iwd.BasicServiceSet" :{"Address" :{"type" :"s" ,"data" :"00:aa:bb:cc:dd:06" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/686f6d652d776966692d6f6c64_psk" :{"net.connman.iwd.KnownNetwork" :{"Name" :{"type" :"s" ,"data" :"home-wifi-old" },"Type" :{"type" :"s" ,"data" :"psk" },"Hidden" :{"type" :"b" ,"data" :false },"AutoConnect" :{"type" :"b" ,"data" :true },"LastConnectedTime" :{"type" :"s" ,"data" :"2025-06-08T09:42:27Z" }},"org.freedesktop.DBus.Properties" :{}},"/net/connman/iwd/686f6d652d77696669_psk" :{"net.connman.iwd.KnownNetwork" :{"Name" :{"type" :"s" ,"data" :"home-wifi" },"Type" :{"type" :"s" ,"data" :"psk" },"Hidden" :{"type" :"b" ,"data" :false },"AutoConnect" :{"type" :"b" ,"data" :true },"LastConnectedTime" :{"type" :"s" ,"data" :"2026-06-28T17:12:44Z" }},"org.freedesktop.DBus.Properties" :{}}}]}quickshell/nuguland/test-fixtures/iwd/ordered-networks.json Added new file mode 100644+1 / −0 text lines
1 + {"type" :"a(on)" ,"data" :[[["/net/connman/iwd/0/4/686f6d652d77696669_psk" ,-6800 ],["/net/connman/iwd/0/4/686f6d652d776966692d3567_psk" ,-4900 ],["/net/connman/iwd/0/4/436166652047756573742057694669_psk" ,-6500 ],["/net/connman/iwd/0/4/67756573742d6e6574_psk" ,-6500 ],["/net/connman/iwd/0/4/4369747920486f7473706f74_open" ,-6600 ],["/net/connman/iwd/0/4/52656164696e6720526f6f6d_open" ,-6800 ],["/net/connman/iwd/0/4/4e65696768626f72203247_psk" ,-8400 ],["/net/connman/iwd/0/4/736b796e65742d6775657374_psk" ,-8600 ],["/net/connman/iwd/0/4/6f322d53706f742d31323334_psk" ,-8500 ],["/net/connman/iwd/0/4/6f66666963652d77696669_psk" ,-8500 ],["/net/connman/iwd/0/4/636166652d636f726e6572_psk" ,-8900 ]]]}