summaryrefslogtreecommitdiff
path: root/services/Network.qml
diff options
context:
space:
mode:
authorPiotr Bartoszewicz <piotrek15.pb@gmail.com>2025-06-08 18:18:04 +0200
committerPiotr Bartoszewicz <piotrek15.pb@gmail.com>2025-06-08 18:18:04 +0200
commit790cb3e911bdb4894cb33263d83237f81232a945 (patch)
tree963d7cc8c0ffacc964c0faf577c65d7245c77e13 /services/Network.qml
parentfix(network): duplicate networks overwrite activity status (diff)
downloadcaelestia-shell-790cb3e911bdb4894cb33263d83237f81232a945.tar.gz
caelestia-shell-790cb3e911bdb4894cb33263d83237f81232a945.tar.bz2
caelestia-shell-790cb3e911bdb4894cb33263d83237f81232a945.zip
refactor(network): add bssid to AccessPoint component
Diffstat (limited to 'services/Network.qml')
-rw-r--r--services/Network.qml15
1 files changed, 8 insertions, 7 deletions
diff --git a/services/Network.qml b/services/Network.qml
index d3368f3..b4827c8 100644
--- a/services/Network.qml
+++ b/services/Network.qml
@@ -23,31 +23,31 @@ Singleton {
Process {
id: getNetworks
running: true
- command: ["sh", "-c", `nmcli -g ACTIVE,SIGNAL,FREQ,SSID d w | jq -ncR '[(inputs / ":") | select(.[3] | length >= 4)]'`]
+ command: ["sh", "-c", `nmcli -g ACTIVE,SIGNAL,FREQ,SSID,BSSID d w | jq -ncR '[(inputs | split("(?<!\\\\\\\\):"; "g")) | select(.[3] | length >= 4)]'`]
stdout: SplitParser {
onRead: data => {
- const networks = JSON.parse(data)
- .filter(n => n[0] === "yes")
- .map(n => [n[0] === "yes", parseInt(n[1]), parseInt(n[2]), n[3]]);
+ const networks = JSON.parse(data).map(n => [n[0] === "yes", parseInt(n[1]), parseInt(n[2]), n[3], n[4].replace(/\\/g, "")]);
const rNetworks = root.networks;
- const destroyed = rNetworks.filter(rn => !networks.find(n => n[2] === rn.frequency && n[3] === rn.ssid));
+ const destroyed = rNetworks.filter(rn => !networks.find(n => n[2] === rn.frequency && n[3] === rn.ssid && n[4] === rn.bssid));
for (const network of destroyed)
rNetworks.splice(rNetworks.indexOf(network), 1).forEach(n => n.destroy());
for (const network of networks) {
- const match = rNetworks.find(n => n.frequency === network[2] && n.ssid === network[3]);
+ const match = rNetworks.find(n => n.frequency === network[2] && n.ssid === network[3] && n.bssid === network[4]);
if (match) {
match.active = network[0];
match.strength = network[1];
match.frequency = network[2];
match.ssid = network[3];
+ match.bssid = network[4];
} else {
rNetworks.push(apComp.createObject(root, {
active: network[0],
strength: network[1],
frequency: network[2],
- ssid: network[3]
+ ssid: network[3],
+ bssid: network[4]
}));
}
}
@@ -57,6 +57,7 @@ Singleton {
component AccessPoint: QtObject {
required property string ssid
+ required property string bssid
required property int strength
required property int frequency
required property bool active