]>
code.delx.au - spectrwm/blob - baraction.sh
4 typeset
-R4 _1
=${1} _2=${2} _3=${3} _4=${4} _5=${5}
5 echo -n "CPU:${_1}% User${_2}% Nice${_3}% Sys${_4}% Int${_5}% Idle "
10 # iostat prints each column justified to 3 chars, so if one counter
11 # is 100, it jams up agains the preceeding one. sort this out.
12 while [ "${1}x" != "x" ]; do
13 if [ ${1} -gt 99 ]; then
14 OUT
="$OUT ${1%100} 100"
28 if [ $AC_STATUS -ne 255 -o $BAT_STATUS -lt 4 ]; then
29 if [ $AC_STATUS -eq 0 ]; then
30 echo -n "on battery (${BAT_LEVEL}%)"
37 AC_STRING
="on backup AC: "
45 BAT_STRING
="(no battery)"
48 BAT_STRING
="(battery ${BAT_LEVEL}%)"
51 BAT_STRING
="(battery unknown)"
55 FULL
="${AC_STRING}${BAT_STRING}"
56 if [ "$FULL" != "" ]; then
64 # instead of sleeping, use iostat as the update timer.
65 # cache the output of apm(8), no need to call that every second.
66 /usr
/sbin
/iostat
-C -c 3600 |
& # wish infinity was an option
70 if [ $
(( ${I} % 59 )) -eq 0 ]; then
71 APM_DATA
=`/usr/sbin/apm -alb`