This is a collection of dotfiles and scripts for my bspwm setup
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
664 B

#!/bin/sh
BAT_NUMBER=${BLOCK_INSTANCE:-"$(acpi -b | grep ': [^Unknown]' | awk '{ print int($2) }')"}
BAT_INFO="$(acpi -b | grep Battery\ $BAT_NUMBER:)"
CAPACITY=$(echo $BAT_INFO | awk '{ print int($4) }')
TIME="$(echo $BAT_INFO | awk '{ print substr($5, 0, length($5) - 3) }')"
if [ "$(echo $BAT_INFO | awk '{ print $6 }')" = "remaining" ]; then
if [ "$CAPACITY" -ge "80" ]; then
ICON=""
elif [ "$CAPACITY" -ge "60" ]; then
ICON=""
elif [ "$CAPACITY" -ge "40" ]; then
ICON=""
elif [ "$CAPACITY" -ge "20" ]; then
ICON=""
else
ICON=""
fi
else
ICON=""
fi
echo "$ICON $CAPACITY% ($TIME)"
echo "$ICON $CAPACITY%"
echo "#FFFFFF"