blob: 93c8d50d425689eb6e545e5476d450289bc9fbde (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
}
}
|