Fixed calculation for battery percentage

This commit is contained in:
Michael Wolman 2016-01-13 19:05:03 -05:00
commit 8c70000f25

View file

@ -91,7 +91,7 @@ elif [[ $(uname) == "Linux" ]] ; then
}
function battery_pct_prompt() {
b=$(battery_pct_remaining)
b=$(battery_pct_remaining)
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
if [ $b -gt 50 ] ; then
color='green'
@ -136,7 +136,7 @@ function battery_level_gauge() {
local battery_remaining_percentage=$(battery_pct);
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
local filled=$(((( $battery_remaining_percentage * $gauge_slots) / 100)));
local empty=$(($gauge_slots - $filled));
if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;