wmii/rc/status

35 lines
938 B
Bash

#!9PREFIX/bin/rc
# periodically print date and load average to the bar
PIDFILE=/tmp/.ixp-$USER/statuspid-$WMII_IDENT
if(test -r $PIDFILE) {
kill -2 `{cat $PIDFILE} >[2]/dev/null
}
echo $pid >$PIDFILE
label=`{wmiir read /bar/new}
wmiir write /bar/$label/b1press 'wmiir write /wm/ctl ''select prev'''
wmiir write /bar/$label/b3press 'wmiir write /wm/ctl ''select next'''
wmiir write /bar/$label/b4press 'wmiir write /wm/ctl ''select prev'''
wmiir write /bar/$label/b5press 'wmiir write /wm/ctl ''select next'''
# install signal handler for artificial sigexit:
fn sigint {
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
rm -f $PIDFILE
wmiir write /bar/ctl 'destroy '^$label
exit
}
fn statustext {
# if you need a formatted date, use awk
echo (`{date} `{uptime | sed 's/.*://; s/,//g'})
}
text=`{statustext}
while(wmiir write /bar/$label/data $"text >[2]/dev/null) {
text=`{statustext}
sleep 2
}