lemonbar now uses connman

This commit is contained in:
Enrico Fasoli 2015-09-25 18:27:33 +02:00
parent 2c615912e7
commit 7149994889

View File

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