How to make notification when battery is low 15%-10% and how to make notification when battery already full in charge?
Thanks in advance.
elementary OS Stack Exchange is a question and answer site for developers and users of elementary OS and applications. It only takes a minute to sign up.
Sign up to join this communityI have written a custom script that will do as shown below:
Script:
#!/usr/bin/env bash
while true
do
export DISPLAY=:0.0
battery_percent=$(acpi -b | grep -P -o '[0-9]+(?=%)')
if on_ac_power; then
if [ "$battery_percent" -gt 98 ]; then
notify-send --app-name=battery "Battery full." "Level: ${battery_percent}% "
fi
else
if [ "$battery_percent" -lt 15 ]; then
notify-send --app-name=battery "Battery low." "Level: ${battery_percent}% "
elif [ "$battery_percent" -lt 10 ]; then
notify-send --app-name=battery "Battery Critical." "Level: ${battery_percent}% "
fi
fi
sleep 300 # (5 minutes)
done
Installation:
Run:
sudo apt install acpi
Save above script as "battery_notification.sh" under "/usr/local/bin"
sudo chmod +x /usr/local/bin/battery_notification.sh
Run Script at start-up:
Open System Setting -> Applications -> Startup
/usr/local/bin/battery_notification.sh
I was searching for the same thing. Here I found a solution to get notifications for low and critically low battery state: Battery notifications
For the second part of your question
You can follow this answer here