From 378221ec364d59c0b1ce15b80e6376dad9567af8 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Tue, 30 Jun 2015 14:27:05 +0200 Subject: [PATCH] =?UTF-8?q?Adapterstatus=20per=20acpi=5Flisten=20vertr?= =?UTF-8?q?=C3=A4gt=20sich=20nicht=20mit=20sleep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/bar.sh | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) 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