here are the diffs to toggle hide/unhide on the right click.  the purist
would say winwatch should be able to hide itself, but guarding against
it seems more functional.

term% diff winwatch.c.orig winwatch.c
198,199c198,199
<       int fd, i, j;   
<       char buf[128];
---
>       int fd, i, j, n;
>       char buf[128], rbuf[128];
228c228
<       if((fd = open(buf, OWRITE)) < 0)
---
>       if((fd = open(buf, ORDWR)) < 0)
230,232c230,238
<       write(fd, "unhide\n", 7);
<       write(fd, "top\n", 4);
<       write(fd, "current\n", 8);
---
>       if ((n = read(fd, rbuf, 128)) < 0)
>               return;
>       rbuf[n] = 0;
>       if (strstr(rbuf, "hidden")) {
>               write(fd, "unhide\n", 7);
>               write(fd, "top\n", 4);
>               write(fd, "current\n", 8);
>       } else if (strcmp(win[i].label, "winwatch") != 0)
>               write(fd, "hide\n", 5);

Reply via email to