Skip to content

Instantly share code, notes, and snippets.

@paragasu
Created March 18, 2017 05:43
Show Gist options
  • Save paragasu/2b280c047a198b5a4ec967b6eaf405d8 to your computer and use it in GitHub Desktop.
Save paragasu/2b280c047a198b5a4ec967b6eaf405d8 to your computer and use it in GitHub Desktop.
Play mp3 sound once battery reach 5%
#!/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