diff --git a/lemonbar.sh b/lemonbar.sh index 1c9f433..3b44e7f 100755 --- a/lemonbar.sh +++ b/lemonbar.sh @@ -40,14 +40,24 @@ getMPD(){ } getNET(){ - if [ ! -f /tmp/myip ]; then - echo "$(curl -s --connect-timeout 1 http://canihazip.com/s)" > /tmp/myip - fi - IP="$(cat /tmp/myip)" - if [ -n "$IP" ]; then - echo -n "%{F$GREEN}$IP" + NDATA=$(connmanctl services | grep "*A") + NSTATE=$(echo $NDATA | cut -b3) + NNAME=$(echo $NDATA | cut -d' ' -f2) + + if [ "$NSTATE" == "c" ]; then + NCOLOR="$GREY" + elif [ "$NSTATE" == "R" ]; then + NCOLOR="$BLUE" + elif [ "$NSTATE" == "O" ]; then + NCOLOR="$GREEN" else + NCOLOR="$RED" + fi + + if [ "$NCOLOR" == "$RED" ]; then echo -n "%{F$RED}Offline" + else + echo -n "%{F$NCOLOR}$NNAME" fi }