Created
October 15, 2015 19:59
-
-
Save wallentx/d8e5545559a5698a7728 to your computer and use it in GitHub Desktop.
Network indicator for lemonbar
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
network() { | |
eth0=$(cat /sys/class/net/eth0/carrier 2>/dev/null) | |
wlan0=$(cat /sys/class/net/wlan0/carrier 2>/dev/null) | |
vpn=$(cat /sys/class/net/ppp0/carrier 2>/dev/null) | |
if [[ $vpn -eq 1 ]]; then | |
echo -e '\uf084' | |
ping -W 1 -c 1 8.8.8.8 >/dev/null 2>&1 && echo -e '\uf00c ' || echo -e '\uf00d' | |
elif [[ $eth0 -eq 1 ]] && [[ $vpn -ne 1 ]]; then | |
echo -e '\uf0ac' | |
ping -W 1 -c 1 8.8.8.8 >/dev/null 2>&1 && echo -e '\uf00c ' || echo -e '\uf00d' | |
elif [[ $wlan0 -eq 1 ]] && [[ $vpn -ne 1 ]] && [[ $eth0 -ne 1 ]]; then | |
echo -e '\uf1eb' | |
ping -W 1 -c 1 8.8.8.8 >/dev/null 2>&1 && echo -e '\uf00c ' || echo -e '\uf00d' | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment