First make sure that a battery is present.

Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
This commit is contained in:
Jacob Kiers 2014-09-25 10:07:51 +02:00
parent e194d43baa
commit eb61134f29

View File

@ -42,6 +42,10 @@ battery_status()
case $(uname -s) in
"Linux")
BATPATH=${BATPATH:-/sys/class/power_supply/BAT0}
if [ ! -d $BATPATH ]; then
exit 0
fi
STATUS=$BATPATH/status
[ "$1" = `cat $STATUS` ] || [ "$1" = "" ] || return 0
if [ -f "$BATPATH/energy_full" ]; then