Last active
December 15, 2015 01:49
-
-
Save schtibe/5182679 to your computer and use it in GitHub Desktop.
Awesome battery widget updater
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 | |
while true ; do | |
state=`acpi -b` | |
percentage=`echo $state | grep -oP '\d+(?=%)'` | |
color='green' | |
echo $state | grep 'Discharging' && [[ $percentage -lt 15 ]] && color='red' | |
echo $state | grep 'Discharging' && [[ $percentage -gt 15 ]] && color='yellow' | |
text="<span foreground=\"$color\">$state</span>" | |
echo "bat_text:set_markup('$text')" | awesome-client | |
sleep 10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment