Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With sounds #2

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# linux-battery-notifier

Sends notification when battery is above 95 to unplug the AC adapter and when battery is at 30, 40 and below 20 to plug-in AC adapter again.
With this branch I also play notification sounds, because it doesn't show notifications.
If we are in fullscreen mode let's say you are wathing a youtube video,
you won't get any notifications earlier but now I sorted it.

## Steps to run this

Expand All @@ -9,7 +12,7 @@ Sends notification when battery is above 95 to unplug the AC adapter and when ba
sudo apt install acpi
```
- Make file executable
- If any of your folder/directory name contains space like 'My Things' while writing file path write fodler name as
- If any of your folder/directory name contains space like 'My Things' while writing file path write folder name as
- My\ Things
- Else You might get an error of no such file or directory
```
Expand Down
20 changes: 15 additions & 5 deletions battery-notifier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,29 @@ while true; do
if [ "$ac_adapter" == "off" ]; then
if [ $battery_level -le 20 ]; then #check if the battery level is over 90%
notify-send -u critical "Please, kindly plug-in your AC adapter" "Battery level: ${battery_level}%" -i battery-caution
# To get the sound notification
aplay sounds/mixkit-wrong-answer-fail-notification-946.wav
# break
# sleep 180
elif [ $battery_level == 30 ]; then
elif [ $battery_level -le 30 ]; then
notify-send -u critical "Charge it man its ${battery_level}%" -i battery-caution

# To get the sound notification
aplay sounds/mixkit-bell-notification-933.wav
# break
# sleep 180
sleep 200
elif [ $battery_level == 40 ]; then
notify-send -u critical "Its ${battery_level}%" -i face-angel
# To get the sound notification
aplay sounds/mixkit-bell-notification-933.wav

# break
# sleep 180
sleep 180
elif [ $battery_level -ge 95 ]; then
notify-send -u critical "Thank you!!!" "You did an excellent job, Keep it up." -i face-angel
sleep 300 # sleep as charging is above 95
notify-send -u critical "Thank you!!!" "You did an excellent job,Now remove the charger." -i face-angel
# To get the sound notification
aplay sounds/mixkit-melodical-flute-music-notification-2310.wav
sleep 90 # sleep as charging is above 95
fi
fi
sleep 5 #wait for 300 seconds before checking again
Expand Down
Binary file added sounds/mixkit-bell-notification-933.wav
Binary file not shown.
Binary file added sounds/mixkit-happy-bells-notification-937.wav
Binary file not shown.
Binary file not shown.
Binary file not shown.