From fa5b31292401a80484ff6f81a5b68603b3889428 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 29 Apr 2025 14:56:39 +1000 Subject: feat: bar network icon --- services/Network.qml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 services/Network.qml (limited to 'services/Network.qml') diff --git a/services/Network.qml b/services/Network.qml new file mode 100644 index 0000000..93c8d50 --- /dev/null +++ b/services/Network.qml @@ -0,0 +1,44 @@ +pragma Singleton + +import Quickshell +import Quickshell.Io +import QtQuick + +Singleton { + id: root + + readonly property AccessPoint active: AccessPoint { + active: true + } + + Process { + running: true + command: ["nmcli", "m"] + stdout: SplitParser { + onRead: getNetworks.running = true + } + } + + Process { + id: getNetworks + running: true + command: ["nmcli", "-g", "ACTIVE,SIGNAL,FREQ,SSID", "d", "w"] + stdout: SplitParser { + onRead: data => { + const [active, strength, frequency, ssid] = data.split(":"); + if (active === "yes") { + root.active.ssid = ssid; + root.active.strength = parseInt(strength); + root.active.frequency = parseInt(frequency); + } + } + } + } + + component AccessPoint: QtObject { + property string ssid + property int strength + property int frequency + property bool active + } +} -- cgit v1.2.3-freya