[wmii] Status script

From: Jani H. Lahtinen <jani.h.lahtinen_AT_nokia.com>
Date: Fri, 28 Oct 2005 14:11:01 +0300


I tried to modify my status -script to display the time, wireless
connection quality and the laptop battery status. I copied the Garbeam's
dotfiles and changes the block of the while loop in the status -script to:

    date=`{date '+%H:%M'}
    signal=`{cat /proc/net/wireless | awk '{print $3}' | sed -n '3p'}
    cap=`{cat /proc/acpi/battery/BAT0/info | sed -n 's/last full
capacity:\s*\([0-9]*\) mWh/\1/p'}
    rem=`{cat /proc/acpi/battery/BAT0/state | sed -n 's/remaining
capacity:\s*\([0-9]*\) mWh/\1/p'}
    battery=`{dc -e $"rem^' 100 * '$"cap^' / p'}
    text=$"date^' '^$"signal^' '^$"battery
    sleep $DELAY

The wlan quality is displayed fine, but strangely the battery status
only shows 100 all the time. If I simply start /usr/local/9/bin/rc and
cut-and-paste the above instruction `echo $text` shows a credible
reading of the battery state. What's the mystery?
Received on Fri Oct 28 2005 - 13:12:00 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:24 UTC