Derive the network bar pill from the native Networking service

The pill was populated by polling omarchy-network-status (previously
every 3s, then 10s). Derive kind/signalStrength directly from the
Quickshell.Networking service instead: wired-connected → ethernet
(preferred, matching the default-route device), else a connected Wi-Fi
network → wifi with its signal, else disconnected. The service's
properties are change-notified, so the pill updates on connect/
disconnect and signal changes with no polling and no subprocess.

Removes the last periodic poll from the bar; the label/frequency pill
fields were write-only and are dropped.

Verified live: pill tracks ethernet → disconnected → ethernet in real
time as the wired device goes down and up.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-20 07:56:43 -07:00
co-authored by Claude Fable 5
parent b956069465
commit ad023413c6
+11 -31
View File
@@ -245,20 +245,18 @@ Panel {
connectKnown(net.ssid) connectKnown(net.ssid)
} }
// Bar pill state. Polled locally so this panel is self-contained; // Bar pill state, derived from the native NetworkManager service so the
// populated by networkProc + networkTimer below. // icon reflects connection changes without polling. Wired is preferred
property string kind: "disconnected" // when both are up, matching the default-route device.
property string label: "" readonly property var wiredDevice: findDevice(DeviceType.Wired)
property int signalStrength: -1 readonly property string kind: {
property string frequency: "" if (wiredDevice && wiredDevice.connected) return "ethernet"
if (connectedWifiNetwork) return "wifi"
function updateNetwork(raw) { return "disconnected"
var parsed = Model.parseNetworkStatus(raw)
kind = parsed.kind
label = parsed.label
signalStrength = parsed.signalStrength
frequency = parsed.frequency
} }
readonly property int signalStrength: connectedWifiNetwork
? Math.round((connectedWifiNetwork.signalStrength || 0) * 100)
: -1
function copyToClipboard(value) { function copyToClipboard(value) {
if (!value || !root.bar) return if (!value || !root.bar) return
@@ -1493,24 +1491,6 @@ Panel {
} }
} }
// Poll the wifi/ethernet pill state every 3s. Local to this panel so
// Bar.qml does not need to mirror network state.
Process {
id: networkProc
command: ["omarchy-network-status"]
stdout: StdioCollector {
waitForEnd: true
onStreamFinished: root.updateNetwork(text)
}
}
Timer {
interval: 10000
running: true
repeat: true
triggeredOnStart: true
onTriggered: if (!networkProc.running) networkProc.running = true
}
component DetailValue: InfoValue { component DetailValue: InfoValue {
property bool copyable: false property bool copyable: false