diff --git a/rc/status b/rc/status index d38e91b0..9cdb4ee5 100644 --- a/rc/status +++ b/rc/status @@ -3,17 +3,20 @@ PIDFILE=/tmp/ns.$USER.$DISPLAY/statuspid -fn xwrite { echo -n $2 | wmiir write $1 } - 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 } @@ -22,8 +25,6 @@ fn statustext { echo `{date} `{uptime | sed 's/.*://; s/,//g'} } -text=`{statustext} -while(xwrite /bar/3/data $"text) { +while(text=`{statustext} xwrite /bar/$lab/data $"text){ sleep 2 - text=`{statustext} } diff --git a/rc/wmiirc b/rc/wmiirc index 8f749536..9b7ba35c 100755 --- a/rc/wmiirc +++ b/rc/wmiirc @@ -6,6 +6,9 @@ PIDFILE=/tmp/ns.$USER.$DISPLAY/wmiircpid fn xwrite { echo -n $2 | wmiir write $1 } +fn maxlab { + awk '/[0-9]+$/ {if($10>max) max=$10} END{print max}' +} if(test -r $PIDFILE) { kill -2 `{cat $PIDFILE} >[2]/dev/null @@ -46,11 +49,10 @@ for(page in `{wmiir read / | awk '/^d/ && !/new$/ {print $NF}'}) { } # 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] xwrite /bar/new/colors $WMII_NORMCOLORS xwrite /bar/new/colors $WMII_SELCOLORS -xwrite /bar/new/colors $WMII_NORMCOLORS xwrite /bar/1/data 1 xwrite /bar/expand 2