commit 7f6935a8a5cebe8bbab5a397794e5abdc6dcef69
parent 4639edf9b00e721528bceacd80197b4b09a9100c
Author: salva <salva@pandora.hopto.org>
Date: Sun, 19 Feb 2006 11:48:29 +0000
moved the status label creation&removal code to the status script itself
Diffstat:
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git 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
@@ -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