improve bar
authorMart Lubbers <mart@martlubbers.net>
Thu, 15 Nov 2018 08:50:40 +0000 (09:50 +0100)
committerMart Lubbers <mart@martlubbers.net>
Thu, 15 Nov 2018 08:50:40 +0000 (09:50 +0100)
x/.local/bin/bar

index 00da72e..76d6e06 100755 (executable)
@@ -1,24 +1,19 @@
 #!/bin/sh
 batprefix=/sys/class/power_supply/BAT0
 if [ -f $batprefix/charge_full -a -f $batprefix/charge_now ]; then
-       bat="$(echo $(cat $batprefix/charge_now)*100/$(cat $batprefix/charge_full) | bc)% |"
+       bat="$(echo $(cat $batprefix/charge_now)*100/$(cat $batprefix/charge_full) | bc)% |"
 fi
 
 if ip -br a | grep -q '^wlp'; then
        wlan="$(/sbin/iwconfig 2>/dev/null | grep -oP '(?<=ESSID:\").*(?=\")')"
        if [ -z "$wlan" ]; then
-               wlan="Not connected |"
-       else
-               wlan="$wlan |"
+               wlan="Not connected"
        fi
+       wlan="W $wlan | "
 fi
 
-#eval $(xdotool search --onlyvisible trayer getwindowgeometry --shell)
+snd="♪ $(pactl list sinks | grep -Po "(?<=Volume: front)[^%]*" | grep -o "[0-9]\?[0-9][0-9]$" | head -n 1) | "
+dsk="Dsk: $(df -h | grep '/$' | awk '{print $4"/"$2}') | "
+date="$(date +"%Y-%m-%d %H:%M:%S") "
 
-echo \
-       "W $wlan"\
-       "♪ $(pactl list sinks | grep -Po "(?<=Volume: front)[^%]*" | grep -o "[0-9]\?[0-9][0-9]$") |"\
-       "⚡$bat"\
-       "Dsk: $(df -h | grep '/$' | awk '{print $4"/"$2}') |"\
-       "$(date +"%Y-%m-%d %H:%M:%S") "
-#      "$(printf "% $((WIDTH/20+1))s")"
+echo "$wlan$snd$bat$dsk$date"