3 # Stefan Huber <shuber2@gmail.com>
4 # Display battery info for conky
8 if [ -e /sys
/devices
/platform
/smapi
/ ]
10 for b
in `find /sys/devices/platform/smapi/ -type d -name BAT?`
12 if [ `cat $b/installed` = "1" ]
15 remcap
=`cat $b/remaining_capacity`
16 remcapper
=`cat $b/remaining_percent`
17 ratenow
=`cat $b/power_now`
18 rateavg
=`cat $b/power_avg`
19 remtime
=`cat $b/remaining_running_time`
20 tempmilli
=`cat $b/temperature`
21 temp
=`echo "$tempmilli/1000" | bc`
23 if [ "$remtime" = "not_discharging" ]; then
24 remtime
=`cat $b/remaining_charging_time`
26 if [ "$remtime" = "not_charging" ]; then
30 echo "$name rate: $ratenow mW [~ $rateavg mW]"
31 echo "rem: $remcap mWh [$remcapper%, $remtime min]"
32 #echo "$name temp: $tempĀ°C"
36 for b
in `find /proc/acpi/battery/ -type d -name BAT?`
38 if [ `grep -c -E "^present: *yes" $b/state` = "1" ]
41 fullcap
=`grep "last full capacity" $b/info | awk ' { print $4 } '`
42 remcap
=`grep "remaining capacity" $b/state | awk ' { print $3 } '`
43 rate
=`grep "present rate" $b/state | awk ' { print $3 } '`
45 if [ $rate = "0" ]; then
48 remtime
=`echo "$remcap*60/$rate" | bc`
51 remcapper
=`echo "$remcap*100/$fullcap" | bc `
53 echo "$name rate: $rate mW"
54 echo "$name rem.: $remcap mWh [$remcapper%, $remtime min]"