Skip to content

Commit bdf39b9

Browse files
committed
wifi: echo red "down" when interface exists but inactive
1 parent af99ed6 commit bdf39b9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

wifi/wifi

+9-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ fi
2222

2323
# As per #36 -- It is transparent: e.g. if the machine has no battery or wireless
2424
# connection (think desktop), the corresponding block should not be displayed.
25-
[[ ! -d /sys/class/net/${INTERFACE}/wireless ]] ||
26-
[[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && exit
25+
[[ ! -d /sys/class/net/${INTERFACE}/wireless ]] && exit
26+
27+
# If the wifi interface exists but no connection is active, "down" shall be displayed.
28+
if [[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]]; then
29+
echo "down"
30+
echo "down"
31+
echo "#FF0000"
32+
exit
33+
fi
2734

2835
#------------------------------------------------------------------------
2936

0 commit comments

Comments
 (0)