From 40a6eb6330b47872b0bcaec58dec9eac361b860a Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 28 Jul 2022 20:06:53 +0200 Subject: [PATCH] [statusbar] feat: separate states for wifi down and no ssid --- .local/bin/statusbar/sb-internet | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet index def21ed..dbe07c8 100755 --- a/.local/bin/statusbar/sb-internet +++ b/.local/bin/statusbar/sb-internet @@ -13,7 +13,11 @@ # Wifi quality percentage and  icon if ethernet is connected. ssid="$(wpa_cli status | grep -i ^ssid | sed -e 's/.*=//')" state="$(wpa_cli status | grep -i ^wpa_state | sed -e 's/.*=//')" -[ "COMPLETED" = $state ] && str="$(printf " %s" $ssid)" || str="$(printf " ---")" +case "$state" in + COMPLETED) str="$(printf " %s" $ssid)" ;; + INTERFACE_DISABLED) str="WIFI DOWN" ;; + *) str="$(printf "NO WIFI")";; +esac eth="$(cat /sys/class/net/enp0s31f6/operstate)" if [ "up" = "$eth" ]; then str="$(printf "%s /  " "$str")"