nosignal-shell/services/Network.qml
2 * r + 2 * t 9339394e07 bar: use loader instead of swipeview
Also properly set it up
Make network reloadable cause getting is pretty slow
2025-04-30 23:26:16 +10:00

46 lines
1 KiB
QML

pragma Singleton
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
id: root
readonly property AccessPoint active: AccessPoint {
active: true
}
reloadableId: "network"
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
}
}