Created
March 18, 2017 05:43
-
-
Save paragasu/2b280c047a198b5a4ec967b6eaf405d8 to your computer and use it in GitHub Desktop.
Play mp3 sound once battery reach 5%
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author Jeffry L <[email protected]> | |
# 24 July 2014 Bilangau 12:47pm | |
# play random mp3 song once the battery reach 10% | |
# left | |
CHARGE=`acpi -b | cut -d, -f2` | |
VLC=`ps -e | grep vlc` | |
echo Battery Status: $CHARGE | |
# only play cvlc if no process exists yet | |
if [ $CHARGE == "5%" ]; then | |
if [ "$VLC" == "" ]; then | |
cvlc ~/Music/*.mp3 --random & | |
fi | |
fi | |
# battery full | |
if [ $CHARGE == "95%" ]; then | |
zenity --info --text="Battery is almost full" & | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment