wmii/rc/status
2006-02-10 21:26:16 +01:00

30 lines
594 B
Bash

#!9PREFIX/bin/rc
# periodically print date and load average to the bar
PIDFILE=/tmp/ns.$USER.$DISPLAY/statuspid
fn xwrite { echo -n $2 | wmiir write $1 }
if(test -r $PIDFILE) {
kill -2 `{cat $PIDFILE} >[2]/dev/null
}
echo $pid >$PIDFILE
# install signal handler for artificial sigexit:
fn sigint {
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
rm -f $PIDFILE
exit
}
fn statustext {
# if you need a formatted date, use awk
echo `{date} `{uptime | sed 's/.*://; s/,//g'}
}
text=`{statustext}
while(xwrite /bar/3/data $"text) {
sleep 2
text=`{statustext}
}