This script monitors the battery level of your Linux device and provides audio and visual notifications when the battery level drops below a specified threshold while discharging.
- Monitors battery percentage and charging status.
- Provides audio warning using
espeak. - Displays a desktop notification using
notify-send. - Customizable low battery threshold and user name.
Make sure you have the following installed:
- acpi: For fetching battery status.
- espeak: For audio notifications.
- notify-send: For desktop notifications (usually part of the
libnotifypackage).
You can install these packages using your package manager. For example, on Ubuntu, you can run:
sudo apt install acpi espeak libnotify-binLOW_BATTERY_THRESHOLD=20 # Set your desired battery threshold percentage- Run
./low_battery_warning.sh &- Stop
kill %1- View Background Running
jobs- Troubleshooting
upower -i /org/freedesktop/UPower/devices/battery_BAT0For any query mail.mayank001@gmail.com