From 8056b9be3aa7b754be84b5815760ada581c95eb2 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Sat, 5 Nov 2016 22:22:30 +0100 Subject: [PATCH] bar.sh: networkmanager integration --- bspwm/.config/scripts/bar.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/bspwm/.config/scripts/bar.sh b/bspwm/.config/scripts/bar.sh index e5200b1..10c0f39 100755 --- a/bspwm/.config/scripts/bar.sh +++ b/bspwm/.config/scripts/bar.sh @@ -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