Created
January 27, 2016 19:33
-
-
Save coreymwamba/00b0d32cad802e494a59 to your computer and use it in GitHub Desktop.
Batteries. Laptops. Indicators. The eternal struggle. Conky tells you the percentage of the battery; acpi gives you a long string and an estimated time. This script, if used in Conky, will give you both.
This file contains 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 | |
eval $(acpi -b | sed "s/Battery 0: //g" |sed "s/,//g"| awk 'BEGIN {FS=" "}; {print "ch="$1, "percent="$2, "countdown="substr($3,0,5)}') | |
case $ch in | |
Discharging) | |
sign="-" | |
;; | |
Unknown) | |
sign="~" | |
;; | |
Charging) | |
sign="+" | |
esac | |
echo $percent $sign$countdown | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment