History

wctl: defaultcmd

yiyus committed 15 years ago

Commit ca14d461 parent d850dc02 files · +17 −7Browse files

Unified · Split

2 files
  1. devwsys/ixp_fsys.c +3 −2
  2. util/wctl +14 −5
devwsys/ixp_fsys.c+3−2
@@ -402,8 +402,9 @@ fs_read(Ixp9Req *r) { · 401 unmodified lines
402402 ixp_respond(r, nil);
403403 return;
404404 case FsFWctl:
405− // XXX TODO: visible, current
406− sprint(buf, "%11d %11d %11d %11d %s %s ", w->orig.x + w->screenr.min.x, w->orig.y + w->screenr.min.y, w->screenr.max.x, w->screenr.max.y, w-> visible ? "visible" : "hidden", "current");
405+ // XXX TODO: current
406+ s = w-> visible ? "visible" : "hidden";
407+ sprint(buf, "%11d %11d %11d %11d %s %s ", w->orig.x + w->screenr.min.x, w->orig.y + w->screenr.min.y, w->screenr.max.x, w->screenr.max.y, s, "current");
407408 ixp_srv_readbuf(r, buf, strlen(buf));
408409 ixp_respond(r, nil);
409410 return;
util/wctl+14−5
@@ -1,7 +1,7 @@
11 #!/bin/rc
22
33 # Usage
4−# wctl=`{wctl $wsys}
4+# wctl=`{ wctl wsys [defaultcmd] }
55
66 fn window-m {
77 dir = /mnt/wsys
@@ -26,11 +26,15 @@ fn window-m { · 18 unmodified lines
2626 case -hide
2727 shift
2828 }
29− if(~ $#* 0) cmd = rc
29+ if(~ $#* 0) cmd = $defaultcmd
3030 if not cmd = $*
3131 echo -n `{basename $cmd(1)} > /dev/label >[2] /dev/null
32− {
33− echo kill > /proc/^`{cat $dir/kill}^/note
32+ if(test -f $dir/kill){
33+ f=/proc/^`{cat $dir/kill}^/note
34+ # the proces could have finished on
35+ # its own, check it is still there.
36+ if(test -f $f)
37+ echo kill > $f
3438 } &
3539 exec $cmd < /dev/cons > /dev/cons >[2] /dev/cons
3640 }
@@ -51,12 +55,17 @@ fn wctl { · 14 unmodified lines
5155 if (~ $a(1) new) $a
5256 }
5357
54−if(! ~ $1 '')
58+defaultcmd=(rio -i window)
59+if(! ~ $1 ''){
5560 wsys=$1
61+ shift
62+}
5663 if(~ $wsys ''){
5764 echo 'wctl: $wsys not defined'
5865 exit bad
5966 }
67+if(! ~ $1 '')
68+ defaultcmd=$*
6069
6170 service=wctl.$user
6271 # we want to know the pid of the wctl rc,