1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-11 07:52:50 -05:00

parser fix

This commit is contained in:
bbedward
2025-09-18 18:22:37 -04:00
parent bc446dabaf
commit 32f3e579e7
2 changed files with 80 additions and 44 deletions

View File

@@ -467,29 +467,21 @@ Singleton {
Process {
id: getCurrentWifiInfo
command: root.wifiInterface ? lowPriorityCmd.concat(["nmcli", "-t", "-f", "IN-USE,SIGNAL,SSID", "device", "wifi", "list", "ifname", root.wifiInterface, "--rescan", "no"]) : []
command: root.wifiInterface ? lowPriorityCmd.concat(["nmcli", "-t", "-f", "ACTIVE,SIGNAL,SSID", "device", "wifi", "list", "ifname", root.wifiInterface, "--rescan", "no"]) : []
running: false
stdout: SplitParser {
splitMarker: "\n"
onRead: line => {
if (line.startsWith("*:")) {
if (line.startsWith("yes:")) {
const rest = line.substring(2)
const parts = root.splitNmcliFields(rest)
if (parts.length >= 2) {
const signal = parseInt(parts[0])
const signal = parseInt(parts[1])
console.log("Current WiFi signal strength:", signal)
root.wifiSignalStrength = isNaN(signal) ? 0 : signal
root.currentWifiSSID = parts.slice(1).join(":")
}
return
}
if (line.startsWith("yes:")) {
const rest = line.substring(4)
const parts = root.splitNmcliFields(rest)
if (parts.length >= 2) {
root.currentWifiSSID = parts[0]
const signal = parseInt(parts[1])
root.wifiSignalStrength = isNaN(signal) ? 0 : signal
console.log("Current WiFi SSID:", root.currentWifiSSID)
}
return
}