2006-02-25 21:36:53 +03:00
|
|
|
#!/bin/sh
|
|
|
|
# periodically print date and load average to the bar
|
|
|
|
|
|
|
|
pidfile=/tmp/ns.$USER.$DISPLAY/statuspid
|
|
|
|
|
|
|
|
xwrite() {
|
|
|
|
file="$1"; shift
|
|
|
|
echo -n "$@" | wmiir write "$file"
|
|
|
|
}
|
|
|
|
|
|
|
|
# race condition alert
|
|
|
|
test -f $pidfile && kill `cat $pidfile` 2>/dev/null
|
|
|
|
echo $$ >$pidfile
|
2006-03-01 19:30:20 +03:00
|
|
|
sleep 1
|
2006-02-25 21:36:53 +03:00
|
|
|
xwrite /bar/new/colors $WMII_NORMCOLORS
|
|
|
|
n=`wmiir read /bar | awk '/[0-9]+$/ {if($NF>max) max=$NF} END {print max}'`
|
|
|
|
trap "wmiir remove /bar/$n 2>/dev/null; exit" 15
|
|
|
|
|
|
|
|
while true
|
|
|
|
do
|
|
|
|
xwrite /bar/$n/data `date` `uptime | sed 's/.*://; s/,//g'` || exit
|
2006-03-01 14:06:19 +03:00
|
|
|
sleep 1
|
2006-02-25 21:36:53 +03:00
|
|
|
done
|