moved the status label creation&removal code to the status script itself

This commit is contained in:
salva 2006-02-19 11:48:29 +00:00
parent 4639edf9b0
commit 7f6935a8a5
2 changed files with 10 additions and 7 deletions

View File

@ -3,17 +3,20 @@
PIDFILE=/tmp/ns.$USER.$DISPLAY/statuspid PIDFILE=/tmp/ns.$USER.$DISPLAY/statuspid
fn xwrite { echo -n $2 | wmiir write $1 }
if(test -r $PIDFILE) { if(test -r $PIDFILE) {
kill -2 `{cat $PIDFILE} >[2]/dev/null kill -2 `{cat $PIDFILE} >[2]/dev/null
} }
if (~ $1 stop) exit
echo $pid >$PIDFILE echo $pid >$PIDFILE
xwrite /bar/new/colors $WMII_NORMCOLORS
lab=`{wmiir read /bar|maxlab}
# install signal handler for artificial sigexit: # install signal handler for artificial sigexit:
fn sigint { fn sigint {
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid) if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
rm -f $PIDFILE rm -f $PIDFILE
wmiir remove /bar/$lab
exit exit
} }
@ -22,8 +25,6 @@ fn statustext {
echo `{date} `{uptime | sed 's/.*://; s/,//g'} echo `{date} `{uptime | sed 's/.*://; s/,//g'}
} }
text=`{statustext} while(text=`{statustext} xwrite /bar/$lab/data $"text){
while(xwrite /bar/3/data $"text) {
sleep 2 sleep 2
text=`{statustext}
} }

View File

@ -6,6 +6,9 @@ PIDFILE=/tmp/ns.$USER.$DISPLAY/wmiircpid
fn xwrite { fn xwrite {
echo -n $2 | wmiir write $1 echo -n $2 | wmiir write $1
} }
fn maxlab {
awk '/[0-9]+$/ {if($10>max) max=$10} END{print max}'
}
if(test -r $PIDFILE) { if(test -r $PIDFILE) {
kill -2 `{cat $PIDFILE} >[2]/dev/null kill -2 `{cat $PIDFILE} >[2]/dev/null
@ -46,11 +49,10 @@ for(page in `{wmiir read / | awk '/^d/ && !/new$/ {print $NF}'}) {
} }
# BAR CONFIGURATION # BAR CONFIGURATION
for(i in 1 2 3) for(i in `{seq 1 `{wmiir read /bar|maxlab}})
wmiir remove /bar/1 >/dev/null >[2=1] wmiir remove /bar/1 >/dev/null >[2=1]
xwrite /bar/new/colors $WMII_NORMCOLORS xwrite /bar/new/colors $WMII_NORMCOLORS
xwrite /bar/new/colors $WMII_SELCOLORS xwrite /bar/new/colors $WMII_SELCOLORS
xwrite /bar/new/colors $WMII_NORMCOLORS
xwrite /bar/1/data 1 xwrite /bar/1/data 1
xwrite /bar/expand 2 xwrite /bar/expand 2