public
Created

Wireless indicator for xmobar

  • Download Gist
wireless.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!/bin/sh
 
iwconfig eth2 2>&1 | grep -q no\ wireless\ extensions\. && {
echo wired
exit 0
}
 
essid=`nmcli -t -f active,ssid dev wifi | egrep '^yes' | cut -d\' -f2`
stngth=`nmcli -t -f active,ssid,signal dev wifi|grep yes|cut -d':' -f3`
bars=`expr $stngth / 10`
 
case $bars in
0) bar='[----------]' ;;
1) bar='[/---------]' ;;
2) bar='[//--------]' ;;
3) bar='[///-------]' ;;
4) bar='[////------]' ;;
5) bar='[/////-----]' ;;
6) bar='[//////----]' ;;
7) bar='[///////---]' ;;
8) bar='[////////--]' ;;
9) bar='[/////////-]' ;;
10) bar='[//////////]' ;;
*) bar='[----!!----]' ;;
esac
 
echo $essid $bar
 
exit 0

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.