diff options
-rwxr-xr-x | .local/bin/statusbar | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/.local/bin/statusbar b/.local/bin/statusbar index 9f124a7..950a9e1 100755 --- a/.local/bin/statusbar +++ b/.local/bin/statusbar @@ -2,27 +2,30 @@ print_wifi() { if=wlan0 - while IFS=$': \t' read -r label value - do - case $label in SSID) SSID=$value - ;; - signal) SIGNAL=$value - ;; + while IFS=':' read -r k v + do + label=$(echo "$k"|trim) + value=$(echo "$v"|trim) + case $label in + SSID) SSID=$value + ;; + signal) SIGNAL=$value + ;; esac - done < <(iw "$if" link) - test "$SIGNAL" && echo -e "$SSID $SIGNAL" + done <<-EOT + $(iw "$if" link) + EOT + test "$SIGNAL" && echo "$SSID $SIGNAL" } - - while true do xsetroot -name\ "$(printf "%s %s %s %s%% %s"\ "$(print_wifi)"\ - "`ip -4 -j a show wlan0 | jq -r ".[0].addr_info[0].local"`"\ - "$(($(cat /proc/meminfo|grep MemAvailable | awk '{print $2}')/1024))M"\ - "`</sys/class/power_supply/BAT0/capacity`"\ - "`date "+W%V %d/%m %T%:::z"`")" + "$(ip -4 -j a show wlan0 | jq -r ".[0].addr_info[0].local")"\ + "$(($(grep MemAvailable /proc/meminfo | awk '{print $2}')/1024))M"\ + "$(cat /sys/class/power_supply/BAT0/capacity)"\ + "$(date "+W%V %d/%m %T%:::z")")" sleep 1 done |