From eb1593c25d3ea2b307d6f7d40d3be4bbd5b143d3 Mon Sep 17 00:00:00 2001 From: bh Date: Fri, 3 Apr 2026 00:40:04 +0800 Subject: quickshell: fix disconnect logic --- quickshell/.config/quickshell/shell.qml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'quickshell') 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 { -- cgit v1.2.3