diff --git a/scripts/bar.sh b/scripts/bar.sh index b8a552c..6c199f0 100755 --- a/scripts/bar.sh +++ b/scripts/bar.sh @@ -2,7 +2,7 @@ FIFO="/tmp/bar.fifo" -FORMAT=" %(music)s %(services)s %(diskspace)s %%{c} %(debug)s %%{r} %(updates)s %(wifi)s %(adapter)s %(battery)s %(clock)s " +FORMAT=" %(music)s %(services)s %(diskspace)s %%{c} %(debug)s %%{r} %(updates)s %(wifi)s %(battery)s %(clock)s " icon_color="#A0A57E" icon() { echo -n "%{F$icon_color}"; printf '%b' "\ue$1"; echo -n "%{F-}"; } @@ -87,38 +87,18 @@ battery() { if [ "$level" -lt 20 ]; then info="%{F$color_battery_low}$level%%{F-}" fi + + icon=$icon_battery + if [ -n "$(acpi -a | grep on-line )" ]; then + icon=$icon_battery_charging + fi - echo battery "%{A:I battery 1061:}$info%{A}" > $FIFO + echo battery "%{A:I battery 1061:}$icon $info%{A}" > $FIFO sleep 5; done; } -adapter() { - _update() { - icon=$icon_battery - if [ "$1" == "1" ]; then - icon=$icon_battery_charging - fi - echo adapter "%{A:I battery 1061:}$icon%{A}" > $FIFO - } - if [ -n "$(acpi -a | grep on-line)" ]; then - _update 1 - else - _update 0 - fi - - acpi_listen | while read DEVTYPE DEVID FLAGS STATUS; do - if [ "$DEVTYPE" == "ac_adapter" ]; then - if [ "$STATUS" == "00000001" ]; then - _update 1 - else - _update 0 - fi - fi - done -} - clock() { while true; do info=$(date +"%H:%M") @@ -197,7 +177,6 @@ services & diskspace & wifi & updates & -adapter & ( while true; do cat $FIFO; done ) | python ./barformatter.py "$FORMAT" | lemonbar -g 1366x15 -f "Stlarch:size=6:style=regular" -f "Terminus:size=8" -B "#88000000" | run_handler