blob: c8fd54bb7625741ee4c35d51d44a276f595f1a20 (
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
|
pragma Singleton
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
id: root
property string ssid
Process {
id: netProc
command: ["iwctl", "station", "wlan0", "get-networks"]
running: true
stdout: StdioCollector {
onStreamFinished: {
var line = this.text.split("\n").find(line => line.includes(">"))
// remove ANSI escape sequences
line = line.replace(/\x1b\[.*?[@A-Z\[\\\]^_`a-z\{\|\}~]/g, '')
root.ssid = line.split(" ").filter(x => x != "")[1]
}
}
}
Timer {
interval: 5000
running: true
repeat: true
onTriggered: netProc.running = true
}
}
|