Battery capacity in screen hardstatus line hint

Martin Dengler martin at martindengler.com
Sat Jan 5 13:09:19 EST 2008


Hi,

In case this is of use to anyone, I've put the battery capacity in my
xo screen instance's hardstatus line with this tiny script & screenrc
change:

---------- /home/olpc/bin/olpc_screen_status.sh
#!/bin/bash
# Author: Martin Dengler <martin at martindengler.com>
# idea from http://www.mail-archive.com/screen-users@gnu.org/msg00322.html
# based on battery info from olpc-logbat
#
B_INFO=/sys/class/power_supply/olpc-battery

while true
do
    CAP=`cat $B_INFO/capacity`
    echo b:$CAP%
    sleep 60
done
----------

....screenrc change:

---------- /home/olpc/bin/.screenrc
# run command forever and assign most recent output to string escape %1`
backtick 1 0 0 /home/olpc/bin/olpc_screen_status.sh

# the ...%1`... part at the end is the important part
hardstatus alwayslastline "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a %1` "
----------

I'd be interested to know how to get at the ambient temperature sensor
mentioned in section 2.4.1 of the CL1 hardware design specification
PDF.  I've had a look around /sys/class but nothing's jumped out at
me.

Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080105/005a8344/attachment.sig>


More information about the Devel mailing list