summaryrefslogtreecommitdiff
path: root/services/Network.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-29 14:56:39 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-29 14:56:39 +1000
commitfa5b31292401a80484ff6f81a5b68603b3889428 (patch)
treece3470c70e2785589ef315a5c9981e445a0e05df /services/Network.qml
parentstyle: remove unneeded comments (diff)
downloadcaelestia-shell-fa5b31292401a80484ff6f81a5b68603b3889428.tar.gz
caelestia-shell-fa5b31292401a80484ff6f81a5b68603b3889428.tar.bz2
caelestia-shell-fa5b31292401a80484ff6f81a5b68603b3889428.zip
feat: bar network icon
Diffstat (limited to 'services/Network.qml')
-rw-r--r--services/Network.qml44
1 files changed, 44 insertions, 0 deletions
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
+ }
+}