aboutsummaryrefslogtreecommitdiffstats
path: root/.config/herbstluftwm/panel.sh
diff options
context:
space:
mode:
Diffstat (limited to '.config/herbstluftwm/panel.sh')
-rwxr-xr-x.config/herbstluftwm/panel.sh18
1 files changed, 8 insertions, 10 deletions
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh
index ec3b546..3448e62 100755
--- a/.config/herbstluftwm/panel.sh
+++ b/.config/herbstluftwm/panel.sh
@@ -77,16 +77,14 @@ hc pad $monitor $panel_height
77 77
78 while true ; do 78 while true ; do
79 # Network 79 # Network
80 IFS=' ' read -a wlaninfo <<< $(iwconfig wlp3s0) 80 iwconfig=$(iwconfig wlp3s0)
81 for item in ${wlaninfo[@]} ; do 81 ssid_regex=".*ESSID:\"\(.*\)\".*"
82 case $item in 82 quality_regex=".*Link Quality=\([0-9]*\)\/\([0-9]*\).*"
83 ESSID*) 83 ssid=$(echo $iwconfig | sed "s/$ssid_regex/\1/")
84 ssid=$(echo $item | cut -d '"' -f2) ;; 84 IFS=',' read -a quality_info <<< $(echo $iwconfig | sed "s/$quality_regex/\1,\2/")
85 Quality*) 85 cur_qual=${quality_info[0]}
86 quality=$(echo $item | cut -d '=' -f2) ;; 86 max_qual=${quality_info[1]}
87 esac 87 quality_p=$(echo "$cur_qual*100/$max_qual" | bc)
88 done
89 quality_p=$(echo "$(echo $quality | cut -d '/' -f1) * 100 / $(echo $quality | cut -d '/' -f2)" | bc)
90 echo -e "wireless\t^fg($normal_txt)Wlan: $quality_p% ^fg($inactive_txt)($ssid)" 88 echo -e "wireless\t^fg($normal_txt)Wlan: $quality_p% ^fg($inactive_txt)($ssid)"
91 89
92 # Battery 90 # Battery