diff --git a/.local/bin/tools/statusbar/battery b/.local/bin/tools/statusbar/battery index 906306c..1aaa63a 100755 --- a/.local/bin/tools/statusbar/battery +++ b/.local/bin/tools/statusbar/battery @@ -11,8 +11,10 @@ total=$(echo $acpi | sed 's/.*:\ //') status="$(echo $total | cut -d',' -f1)" 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 "Discharging") @@ -27,4 +29,7 @@ case "$status" in icon="^b#282828^^c#dfdfdf^ ⚡ ^d^";; esac +capacity=$(echo "$capacity" | sed -e 's/$//') +capacity=$(printf %3s $capacity | tr ' ' ' ') + echo "$icon $capacity%"