diff options
| author | bh <qn+git@epicurus.dev> | 2026-04-03 00:40:04 +0800 |
|---|---|---|
| committer | bh <qn+git@epicurus.dev> | 2026-04-03 00:40:04 +0800 |
| commit | eb1593c25d3ea2b307d6f7d40d3be4bbd5b143d3 (patch) | |
| tree | b7d79a657edaf0f278642417491738f60caee872 /quickshell/.config | |
| parent | bbc566eaae97e481d78bdb54395fecb13bf52c8d (diff) | |
quickshell: fix disconnect logic
Diffstat (limited to 'quickshell/.config')
| -rw-r--r-- | quickshell/.config/quickshell/shell.qml | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/quickshell/.config/quickshell/shell.qml b/quickshell/.config/quickshell/shell.qml index 8ce5869..1281878 100644 --- a/quickshell/.config/quickshell/shell.qml +++ b/quickshell/.config/quickshell/shell.qml @@ -178,6 +178,7 @@ PanelWindow { color: "#FFC500" font.family: "Source Code Pro" font.pixelSize: 14 + visible: text !== "" } Text { @@ -194,6 +195,7 @@ PanelWindow { color: root.fg font.family: "Source Code Pro" font.pixelSize: 14 + visible: text !== "" } } @@ -207,21 +209,21 @@ PanelWindow { Process { id: wlanProc - command: ["sh", "-c", "WIFACE=$(ip -o link show up | grep -oP 'wl[^:]+' | head -1); EIFACE=$(ip -o link show up | grep -oP 'en[^:]+' | head -1); if [ -n \"$WIFACE\" ]; then SSID=$(iwgetid -r 2>/dev/null); IP=$(ip -4 -o addr show $WIFACE 2>/dev/null | cut -d' ' -f7 | cut -d/ -f1); echo \"wifi $WIFACE $SSID $IP\"; elif [ -n \"$EIFACE\" ]; then IP=$(ip -4 -o addr show $EIFACE 2>/dev/null | cut -d' ' -f7 | cut -d/ -f1); echo \"eth $EIFACE $IP\"; else echo disconnected; fi"] + command: ["sh", "-c", "WIFACE=$(ip -o link show up | grep -oP 'wl[^:]+' | head -1); EIFACE=$(ip -o link show up | grep -oP 'en[^:]+' | head -1); if [ -n \"$WIFACE\" ]; then SSID=$(iwgetid -r 2>/dev/null); if [ -n \"$SSID\" ]; then IP=$(ip -4 -o addr show $WIFACE 2>/dev/null | cut -d' ' -f7 | cut -d/ -f1); echo \"wifi|$WIFACE|$SSID|$IP\"; else echo disconnected; fi; elif [ -n \"$EIFACE\" ]; then IP=$(ip -4 -o addr show $EIFACE 2>/dev/null | cut -d' ' -f7 | cut -d/ -f1); echo \"eth|$EIFACE|$IP\"; else echo disconnected; fi"] stdout: StdioCollector { onStreamFinished: { - var parts = this.text.trim().split(" ") + var parts = this.text.trim().split("|") var type = parts[0] if (type === "wifi") { wlanIcon.text = "" - wlanIface.text = parts[1] + wlanIface.text = parts[1] || "" wlanSsid.text = parts[2] || "" wlanSsid.color = root.fg wlanSsid.font.bold = true wlanIp.text = parts[3] || "" } else if (type === "eth") { - wlanIcon.text = "ETH_ICON" - wlanIface.text = parts[1] + wlanIcon.text = "" + wlanIface.text = parts[1] || "" wlanSsid.text = "" wlanIp.text = parts[2] || "" } else { |
