dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 1ff9e6f10ce4415082bc9df1ac419cb41168176d
parent c034811ea4590ebc0c0f89fe0d6fbad592b22221
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon,  4 Mar 2019 21:00:51 +0100

Use BAT0 as default battery and tweak output

Diffstat:
Mlinks/.config/i3/i3scripts/i3battery | 21+++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/links/.config/i3/i3scripts/i3battery b/links/.config/i3/i3scripts/i3battery @@ -11,25 +11,18 @@ case $BLOCK_BUTTON in - Text color reflects charge left" ;; esac -capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit -status=$(cat /sys/class/power_supply/"$1"/status) +BAT=${1:-BAT0} + +capacity=$(cat /sys/class/power_supply/"$BAT"/capacity) || exit +status=$(cat /sys/class/power_supply/"$BAT"/status) time=" ($(acpi -b | egrep -o '[0-9][0-9]:[0-9][0-9]'))" [ "$time" = " ()" ] && time="" -powerdraw=" $(( $(cat /sys/class/power_supply/"$1"/power_now)/1000000 ))W" +powerdraw=" $(( $(cat /sys/class/power_supply/"$BAT"/power_now)/1000000 ))W" [[ "$powerdraw" = " 0W" ]] && powerdraw="" warn="" -if [ "$capacity" -ge 80 ]; then - #color="#b8bb26" - color="#FFF" -elif [ "$capacity" -ge 60 ]; then - #color="#ebdbb2" - color="#FFF" -elif [ "$capacity" -ge 40 ]; then - color="#fabd2f" -elif [ "$capacity" -ge 20 ]; then - color="#fe8019" -else +color="" +if [ "$capacity" -le 20 ]; then color="#fb4934" warn="!" fi