bar.sh: networkmanager integration

This commit is contained in:
madmaurice 2016-11-05 22:22:30 +01:00
parent 00ab639960
commit 8056b9be3a

View file

@ -67,7 +67,7 @@ diskspace() {
done;
}
wifi() {
wifi_wicd() {
while true; do
info=$(wicd-cli --wireless --status | perl -e 'foreach $line (<>) { if($line =~ /Connected to (.+) at .+IP: ([0-9.]+)/ ) { print $1; break; } elsif($line =~ /Connecting to wireless network \"(.+)\"/) { print $1 . " - connecting"; break; } }')
if [ -z "$info" ]; then
@ -79,6 +79,18 @@ wifi() {
done;
}
wifi_nm() {
while true; do
info=$(nmcli -t -f state,connection d | awk -F: '{ if($1=="connected") { print $2; exit; } }')
if [ -z "$info" ]; then
info="(-)"
fi
echo wifi "$icon_wifi $info" > $FIFO;
sleep 2;
done;
}
battery() {
while true; do
level=$(acpi -b | awk -F, 'BEGIN { s=0 } { s+=$2 } END { print int(s/NR) }')
@ -133,7 +145,7 @@ updates() {
}
while true; do
internet=$(wicd-cli --status | grep Connected)
internet=$(nmcli -t -f state d | grep connected)
if [ -z "$internet" ]; then
if [ -z "$pac" ]; then
pac=?
@ -168,7 +180,7 @@ batterysymbol &
music &
services &
diskspace &
wifi &
wifi_nm &
updates &
#Trap magic