mirror of
https://github.com/0intro/wmii
synced 2025-01-18 16:19:23 +03:00
215ac62fd7
don't expect anything to work, files are missing now
31 lines
660 B
Bash
31 lines
660 B
Bash
#!/usr/local/plan9/bin/rc
|
|
# periodically print date and load average to the bar
|
|
|
|
PIDFILE=/tmp/ns.$USER.$DISPLAY/statuspid
|
|
|
|
if(test -r $PIDFILE) {
|
|
kill -2 `{cat $PIDFILE} >[2]/dev/null
|
|
}
|
|
if (~ $1 stop) exit
|
|
echo $pid >$PIDFILE
|
|
|
|
xwrite /bar/new/colors $WMII_NORMCOLORS
|
|
lab=`{wmiir read /bar|maxlab}
|
|
|
|
# install signal handler for artificial sigexit:
|
|
fn sigint {
|
|
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
|
|
rm -f $PIDFILE
|
|
wmiir remove /bar/$lab
|
|
exit
|
|
}
|
|
|
|
fn statustext {
|
|
# if you need a formatted date, use awk
|
|
echo `{date} `{uptime | sed 's/.*://; s/,//g'}
|
|
}
|
|
|
|
while(text=`{statustext} xwrite /bar/$lab/data $"text){
|
|
sleep 2
|
|
}
|