Added battery support for FreeBSD and fixed weird bug
This commit is contained in:
parent
fcc1d50b54
commit
50290737ad
11
fetch
11
fetch
|
@ -1399,10 +1399,19 @@ getbattery () {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
"BSD")
|
||||||
|
case "$distro" in
|
||||||
|
"FreeBSD"*)
|
||||||
|
battery=$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}')
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X")
|
||||||
battery="$(pmset -g batt | grep -o '[0-9]*%')"
|
battery="$(pmset -g batt | grep -o '[0-9]*%')"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
"Windows")
|
"Windows")
|
||||||
battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining /value)"
|
battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining /value)"
|
||||||
battery=${battery/EstimatedChargeRemaining'='}
|
battery=${battery/EstimatedChargeRemaining'='}
|
||||||
|
@ -2081,7 +2090,7 @@ stdout () {
|
||||||
*)
|
*)
|
||||||
"get$func" 2>/dev/null
|
"get$func" 2>/dev/null
|
||||||
eval output="\$$func"
|
eval output="\$$func"
|
||||||
printf "$output "
|
printf "%s" "$output "
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Reference in New Issue