wmii/rc/status
2005-11-18 17:54:58 +02:00

31 lines
890 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=`{wmir read /bar/new}
wmir write /bar/$label/b1press 'wmir write /wm/ctl ''select prev'''
wmir write /bar/$label/b3press 'wmir write /wm/ctl ''select next'''
wmir write /bar/$label/b4press 'wmir write /wm/ctl ''select prev'''
wmir write /bar/$label/b5press 'wmir write /wm/ctl ''select next'''
# install signal handler for artificial sigexit:
fn sigint {
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
rm -f $PIDFILE
wmir write /bar/ctl 'destroy '^$label
exit
}
text=fnord
while(wmir write /bar/$label/data $"text >[2]/dev/null) {
# if you need formatted date, use /bin/date instead
text=(`{date} `{uptime | sed 's/.*://; s/,//g'})
sleep 10
}