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