Skip to content

Instantly share code, notes, and snippets.

@paragasu
Last active March 18, 2017 06:05
Show Gist options
  • Save paragasu/23a6e0d7f95464246170465354fef25c to your computer and use it in GitHub Desktop.
Save paragasu/23a6e0d7f95464246170465354fef25c to your computer and use it in GitHub Desktop.
Display notifcation when battery reach critical level.
#!/bin/bash
# Author Jeffry L. <[email protected]>
# display notification when battery reach critical level
CHARGE=`acpi -b | cut -d, -f2`
VLC=`ps -e | grep vlc`
echo $CHARGE
# only play cvlc if no process exists yet
if [ $CHARGE == "5%" ]; then
notify-send --expire-time=15000 "Battery Low!"
fi
# battery full
if [ $CHARGE == "95%" ]; then
notify-send --expire-time=15000 "Battery Full."
fi
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment