mirror of
https://github.com/0intro/wmii
synced 2024-12-17 17:12:57 +03:00
35 lines
733 B
Bash
35 lines
733 B
Bash
#!9PREFIX/bin/rc
|
|
# periodically print date and load average to the bar
|
|
|
|
WMIIR_ADDRESS='unix!/tmp/.ixp-'^$USER^'/wmiibar-'^$WMII_IDENT
|
|
PIDFILE=/tmp/.ixp-$USER/statuspid-$WMII_IDENT
|
|
|
|
fn xwrite { echo -n $2 | wmiir write $1 }
|
|
|
|
if(test -r $PIDFILE) {
|
|
kill -2 `{cat $PIDFILE} >[2]/dev/null
|
|
}
|
|
echo $pid >$PIDFILE
|
|
|
|
wmiibar -a $WMIIR_ADDRESS &
|
|
|
|
# install signal handler for artificial sigexit:
|
|
fn sigint {
|
|
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
|
|
rm -f $PIDFILE
|
|
xwrite /ctl quit
|
|
exit
|
|
}
|
|
|
|
fn statustext {
|
|
# if you need a formatted date, use awk
|
|
echo (`{date} `{uptime | sed 's/.*://; s/,//g'})
|
|
}
|
|
|
|
text=`{statustext}
|
|
xwrite /new/data $"text
|
|
while(xwrite /1/data $"text) {
|
|
sleep 2
|
|
text=`{statustext}
|
|
}
|