Skip to content

Instantly share code, notes, and snippets.

@pimeys
Created October 21, 2012 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pimeys/3926406 to your computer and use it in GitHub Desktop.
Save pimeys/3926406 to your computer and use it in GitHub Desktop.
Wireless indicator for xmobar
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment