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
402 ixp_respond(r, nil);402 ixp_respond(r, nil);
403 return;403 return;
404 case FsFWctl:404 case FsFWctl:
405 // XXX TODO: visible, current405 // XXX TODO: 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");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");
407 ixp_srv_readbuf(r, buf, strlen(buf));408 ixp_srv_readbuf(r, buf, strlen(buf));
408 ixp_respond(r, nil);409 ixp_respond(r, nil);
409 return;410 return;
util/wctl+14−5
@@ -1,7 +1,7 @@
1#!/bin/rc1#!/bin/rc
2 2
3# Usage3# Usage
4# wctl=`{wctl $wsys}4# wctl=`{ wctl wsys [defaultcmd] }
5 5
6fn window-m {6fn window-m {
7 dir = /mnt/wsys7 dir = /mnt/wsys
@@ -26,11 +26,15 @@ fn window-m { · 18 unmodified lines
26 case -hide26 case -hide
27 shift27 shift
28 }28 }
29 if(~ $#* 0) cmd = rc29 if(~ $#* 0) cmd = $defaultcmd
30 if not cmd = $*30 if not cmd = $*
31 echo -n `{basename $cmd(1)} > /dev/label >[2] /dev/null31 echo -n `{basename $cmd(1)} > /dev/label >[2] /dev/null
32 {32 if(test -f $dir/kill){
33 echo kill > /proc/^`{cat $dir/kill}^/note33 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
34 } &38 } &
35 exec $cmd < /dev/cons > /dev/cons >[2] /dev/cons39 exec $cmd < /dev/cons > /dev/cons >[2] /dev/cons
36 }40 }
@@ -51,12 +55,17 @@ fn wctl { · 14 unmodified lines
51 if (~ $a(1) new) $a55 if (~ $a(1) new) $a
52}56}
53 57
54if(! ~ $1 '')58defaultcmd=(rio -i window)
59if(! ~ $1 ''){
55 wsys=$160 wsys=$1
61 shift
62}
56if(~ $wsys ''){63if(~ $wsys ''){
57 echo 'wctl: $wsys not defined'64 echo 'wctl: $wsys not defined'
58 exit bad65 exit bad
59}66}
67if(! ~ $1 '')
68 defaultcmd=$*
60 69
61service=wctl.$user70service=wctl.$user
62# we want to know the pid of the wctl rc,71# we want to know the pid of the wctl rc,