Adapterstatus per acpi_listen verträgt sich nicht mit sleep

This commit is contained in:
madmaurice 2015-06-30 14:27:05 +02:00
parent d8af6f28bc
commit 378221ec36

View file

@ -2,7 +2,7 @@
FIFO="/tmp/bar.fifo" 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_color="#A0A57E"
icon() { echo -n "%{F$icon_color}"; printf '%b' "\ue$1"; echo -n "%{F-}"; } icon() { echo -n "%{F$icon_color}"; printf '%b' "\ue$1"; echo -n "%{F-}"; }
@ -87,38 +87,18 @@ battery() {
if [ "$level" -lt 20 ]; then if [ "$level" -lt 20 ]; then
info="%{F$color_battery_low}$level%%{F-}" info="%{F$color_battery_low}$level%%{F-}"
fi 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; sleep 5;
done; 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() { clock() {
while true; do while true; do
info=$(date +"%H:%M") info=$(date +"%H:%M")
@ -197,7 +177,6 @@ services &
diskspace & diskspace &
wifi & wifi &
updates & 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 ( 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