diff --git a/sys/man/1/winwatch b/sys/man/1/winwatch index 013439678..a14d4ecb5 100644 --- a/sys/man/1/winwatch +++ b/sys/man/1/winwatch @@ -16,6 +16,8 @@ displays the labels of all current .IR rio (4) windows, refreshing the display every five seconds. Right clicking a window's label unhides, raises and gives focus to that window. +Right clicking a window again hides the window. +Middle clicking a window's label prompts for a new label. Typing .B q or @@ -24,7 +26,7 @@ quits .IR winwatch . Typing .B l -and selecting a window by left click prompts for a new label. +and selecting a window by a click also prompts for a new label. .PP If the .B -e diff --git a/sys/src/cmd/winwatch.c b/sys/src/cmd/winwatch.c index 21922f386..2b35a4542 100644 --- a/sys/src/cmd/winwatch.c +++ b/sys/src/cmd/winwatch.c @@ -236,12 +236,52 @@ eresized(int new) } int -click(Mouse m) +label(Win w, Mouse m) +{ + char buf[512], fname[128]; + int n, fd; + + buf[0] = 0; + n = eenter("label?", buf, sizeof(buf), &m); + if(n <= 0) + return 0; + sprint(fname, "/dev/wsys/%d/label", w.n); + if((fd = open(fname, OWRITE)) < 0) + return 0; + write(fd, buf, n); + close(fd); + refreshwin(); + redraw(screen, 1); + return 1; +} + +int +unhide(Win w) { char buf[128]; - int fd, i; + int fd; - if((m.buttons & 7) != 4) + sprint(buf, "/dev/wsys/%d/wctl", w.n); + if((fd = open(buf, OWRITE)) < 0) + return 0; + if(w.state == (CURRENT|VISIBLE)) + write(fd, "hide\n", 5); + else { + write(fd, "unhide\n", 7); + write(fd, "top\n", 4); + write(fd, "current\n", 8); + } + close(fd); + return 1; +} + +int +click(Mouse m) +{ + int i, b; + + b = m.buttons & 7; + if(b != 2 && b != 4) return 0; for(i=0; i