28 lines
621 B
Bash
Executable File
28 lines
621 B
Bash
Executable File
#!/usr/bin/env bash
|
|
capacity=$(cat /sys/class/power_supply/BAT0/capacity) || break
|
|
status=$(cat /sys/class/power_supply/BAT0/status)
|
|
time_left=$($HOME/.local/scripts/status/battery_time_left);
|
|
|
|
if [[ $status == "Charging" ]]
|
|
then
|
|
status=""
|
|
else
|
|
if [[ $capacity -ge 75 ]]
|
|
then
|
|
status=""
|
|
elif [[ $capacity -ge 50 ]]
|
|
then
|
|
status=""
|
|
elif [[ $capacity -ge 25 ]]
|
|
then
|
|
status=""
|
|
elif [[ $capacity -ge 10 ]]
|
|
then
|
|
status=""
|
|
else
|
|
notify-send -u critical "Charge now!"
|
|
status=""
|
|
fi
|
|
fi
|
|
echo "$status $capacity% $time_left"
|