mirror of
https://github.com/0intro/wmii
synced 2024-11-25 23:30:24 +03:00
moved the status label creation&removal code to the status script itself
This commit is contained in:
parent
4639edf9b0
commit
7f6935a8a5
11
rc/status
11
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}
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user