]>
code.delx.au - spectrwm/blob - baraction.sh
4 # The date is printed to the status bar by default.
5 # To print the date through this script, set clock_enabled to 0
6 # in scrotwm.conf. Uncomment "print_date" below.
7 FORMAT
="%a %b %d %R %Z %Y"
8 DATE
=`date "+${FORMAT}"`
13 MEM
=`/usr/bin/top | grep Free: | awk {'print $6'}`
14 echo -n "Free mem: $MEM "
18 typeset
-R4 _1
=${1} _2=${2} _3=${3} _4=${4} _5=${5}
19 echo -n "CPU:${_1}% User${_2}% Nice${_3}% Sys${_4}% Int${_5}% Idle "
24 # iostat prints each column justified to 3 chars, so if one counter
25 # is 100, it jams up agains the preceeding one. sort this out.
26 while [ "${1}x" != "x" ]; do
27 if [ ${1} -gt 99 ]; then
28 OUT
="$OUT ${1%100} 100"
42 if [ $AC_STATUS -ne 255 -o $BAT_STATUS -lt 4 ]; then
43 if [ $AC_STATUS -eq 0 ]; then
44 echo -n "on battery (${BAT_LEVEL}%)"
51 AC_STRING
="on backup AC: "
59 BAT_STRING
="(no battery)"
62 BAT_STRING
="(battery ${BAT_LEVEL}%)"
65 BAT_STRING
="(battery unknown)"
69 FULL
="${AC_STRING}${BAT_STRING}"
70 if [ "$FULL" != "" ]; then
78 # instead of sleeping, use iostat as the update timer.
79 # cache the output of apm(8), no need to call that every second.
80 /usr
/sbin
/iostat
-C -c 3600 |
& # wish infinity was an option
84 trap "kill $PID; exit" TERM
86 if [ $
(( ${I} % 1 )) -eq 0 ]; then
87 APM_DATA
=`/usr/sbin/apm -alb`