Last active
February 3, 2017 15:26
-
-
Save TexRx/26ee4a76f147d1ee22e1 to your computer and use it in GitHub Desktop.
Wifi strength (with spark) in the console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# objective: | |
# type wifi in the console and get a pretty little graph of your current wifi strength | |
# usage: | |
# > wifi | |
# output: | |
# ▁▃▅█ 59 | |
# first install spark | |
brew install spark | |
# add this alias to your ~/.zshrc file | |
alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/bin/airport' | |
# add this function to your ~/.zshrc (or external function) file | |
wifi () { | |
if [ $(ifconfig en0 | grep UP | wc -l) -eq 1 ] | |
then | |
_linkQual="`airport -I | grep agrCtlRSSI | cut -d':' -f2 | sed 's/-//g'`" | |
if [ $_linkQual -gt 52 ] # >75% link qual | |
then | |
_linkSparked=$(spark 1 2 3 4) | |
elif [ $_linkQual -gt 35 ] # >50% link qual | |
then | |
_linkSparked=$(spark 1 2 3 0) | |
elif [ $_linkQual -gt 17 ] # 25% link qual | |
then | |
_linkSparked=$(spark 1 2 0 0) | |
elif [ $_linkQual -gt 7 ] # 25% link qual | |
then | |
_linkSparked=$(spark 1 0 0 0) | |
else # < 25% | |
_linkSparked=$(spark 0 0 0 0) | |
fi | |
echo $_linkSparked $_linkQual | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment