wmii/extra/p9p/status

24 lines
554 B
Bash

#!/usr/local/plan9/bin/rc
# periodically print date and load average to the bar
PIDFILE=/tmp/ns.$USER.$DISPLAY/`{basename $0}^'pid'
if(test -r $PIDFILE)
kill `{cat $PIDFILE}
echo $pid >$PIDFILE
wmiir create /bar/status
xwrite /bar/status/colors $WMII_NORMCOLORS
# install signal handler for artificial sigexit:
fn sigint {
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
rm -f $PIDFILE
echo $PIDFILE sigint
wmiir remove /bar/status
exit
}
while(text=`{date | sed 's/GMT .*//'} xwrite /bar/status/data $"text){
sleep 2
} &
echo $apid > $PIDFILE