statusbar: battery script changed

master
tiyn 1 year ago
parent 7cddd5c649
commit 8fbffbc7c6

@ -11,8 +11,10 @@ total=$(echo $acpi | sed 's/.*:\ //')
status="$(echo $total | cut -d',' -f1)" status="$(echo $total | cut -d',' -f1)"
capacity="$(echo $total | cut -d',' -f2 | sed 's/%//')" capacity="$(echo $total | cut -d',' -f2 | sed 's/%//')"
capacity=$(echo "$capacity" | sed -e 's/$//')
capacity=$(printf %3s $capacity | tr ' ' ' ') if [ "$status" = "Discharging" ] && [ $capacity -le 15 ] ; then
notify-send -u critical "Battery" "Below 15%"
fi
case "$status" in case "$status" in
"Discharging") "Discharging")
@ -27,4 +29,7 @@ case "$status" in
icon="^b#282828^^c#dfdfdf^ ⚡ ^d^";; icon="^b#282828^^c#dfdfdf^ ⚡ ^d^";;
esac esac
capacity=$(echo "$capacity" | sed -e 's/$//')
capacity=$(printf %3s $capacity | tr ' ' ' ')
echo "$icon $capacity%" echo "$icon $capacity%"

Loading…
Cancel
Save