KATZ@VENERA.ISI.EDU (Alan R. Katz) (08/19/87)
Thanks to all those who replied to my previous message. The best idea(s) I got was to set environment variables to the correct PID when X starts up, then use them to exit. Some suggested using ps and greping "uwm" and killing the process running that command. I think that this kind of thing can be VERY DANGEROUS (suppose someone has some other program called uwm that happens to be running). The only way you can be sure which process it is that you want to kill is to have saved the number when it started. By the way, I have a sharfile of files which puts up a basic X environment on the Sun (should work anywhere). It starts up an X console window, uwm, some xterms, and defines the mouse buttons to be somewhat similar to what they do under suntools. I did this so naive users could start up X in a reasonable way without reading tons of documentation and figuring out which window manager to run. I can mail it to the list if there is enough interest, or it is FTPable from Venera.Isi.Edu (anonymous login) in the file /div2/katz/myx.sharfile. Just FTP, unshar the file, and follow the directions in README. Now, does anyone know how I can have a menu selection to kill a particular window? (such as a perfmon window, for example). Alan (Katz@ISI.EDU) -------
Rick.Busdiecker@H.GP.CS.CMU.EDU (08/20/87)
I put "xdestroy &" on a menu item, where xdestroy is a program which written by David C. Martin, UC Berkeley that grabs the mouse with a bulls-eye cursor and destroys the window that you click on. The program is very short, however Mr. Martin has included a copyright notice without any sort of clarification at the top of the program, so I'll leave it to him to post it if he wants to. It could be written from scratch in a few minutes if you're at all familiar with Xlib. Rick
gancarz@decvax.UUCP (Mike Gancarz) (08/20/87)
Rick.Busdiecker@H.GP.CS.CMU.EDU writes: >I put "xdestroy &" on a menu item, where xdestroy is a program which >written by David C. Martin, UC Berkeley that grabs the mouse with a >bulls-eye cursor and destroys the window that you click on. Just destroying a window doesn't do the trick. The client attached to it won't exit until it gets an error from the server when it tries to write to the window. Unfortunately, some clients (xterm, e.g.) do nothing until the user initiates some input in the window. If the window is gone, then there's no way to force the client to get a write error. Eventually this leads to the familiar 'no more processes" message. What you really want to do here is kill the process behind the window. This is a bit tougher, because the process may be on a remote machine (possibly in another state) and it may not even be a U*IX process. This leads to all sorts of creative solutions, none of which I'm comfortable with. Thinking back, I seem to recall some bright young upstart who came to me with a wonderful new "f.destroy" function that he added to uwm. He never did figure out why he had problems creating new xterms around 4:00 every afternoon. --Mike
bobtl@tekecs.TEK.COM (Bob Toole) (08/20/87)
As previously mentioned, it is very easy to write a program that will destroy a window. I have written such a program and find it less than satisfactory, because it destroys the window but does nothing for the client using that window. The best result I get is that the client dies when it next tries to use the window. This usually leaves garbage diagnostics printed somewhere. The nastier result is that a program is hung waiting for input that it will never get. Anybody have ideas on how to tell the client "I just zapped your window"? And please don't tell me to wait for X11. I know X11 is wonderful, but that doesn't help now.