[dwm] displaying things in the statusbar

From: Tube <tube_AT_count0.net>
Date: Sat, 17 Mar 2007 10:28:27 +0100

hi there,

for anyone who might be interested - here is some code for displaying
the remaining capacity for notebook users in the statusbar:

export CAPACITY=`awk '/last/ { sum += $4 } END { print sum }' /proc/acpi/battery/BAT*/info`
while true
do
  echo `awk '/remaining/ { sum += $3 } END { print int (sum * 100 / ENVIRON["CAPACITY"] + .5) "%" }' /proc/acpi/battery/BAT*/state` `/bin/date '+%x %H:%M:%S'` `uptime | sed 's/.*://; s/,//g'`
  sleep 1
done | dwm

that considers even serveral rechargeable batteries. so, my question is:
has anybody maybe a more efficient or more elegant way of displaying
that?

tube

-- 
tube_AT_count0.net
http://count0.net
Received on Sat Mar 17 2007 - 10:28:35 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:39:24 UTC