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; done;
} }
wifi() { wifi_wicd() {
while true; do 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; } }') 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 if [ -z "$info" ]; then
@ -79,6 +79,18 @@ wifi() {
done; 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() { battery() {
while true; do while true; do
level=$(acpi -b | awk -F, 'BEGIN { s=0 } { s+=$2 } END { print int(s/NR) }') level=$(acpi -b | awk -F, 'BEGIN { s=0 } { s+=$2 } END { print int(s/NR) }')
@ -133,7 +145,7 @@ updates() {
} }
while true; do while true; do
internet=$(wicd-cli --status | grep Connected) internet=$(nmcli -t -f state d | grep connected)
if [ -z "$internet" ]; then if [ -z "$internet" ]; then
if [ -z "$pac" ]; then if [ -z "$pac" ]; then
pac=? pac=?
@ -168,7 +180,7 @@ batterysymbol &
music & music &
services & services &
diskspace & diskspace &
wifi & wifi_nm &
updates & updates &
#Trap magic #Trap magic