summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivia Mackintosh <livvy@base.nu>2022-08-13 21:46:45 +0200
committerOlivia Mackintosh <livvy@base.nu>2022-08-13 21:46:45 +0200
commit9ba6e3c8f5c5ce643377b328525490c4cd451831 (patch)
tree99f15ebb2bc5e76d64f83edc145722978df393d9
parent48cc40f50ae24d187dca24112a9ebd7dccc5f42d (diff)
downloaddotfiles-9ba6e3c8f5c5ce643377b328525490c4cd451831.tar.gz
statusbar: make POSIX compliant
-rwxr-xr-x.local/bin/statusbar31
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