-   Linux - Newbie (
-   -   Need to Kill a child window (

EmeryUWMC 03-07-2007 07:38 PM

Need to Kill a child window
I need to kill a child window without killing the parent.

I tried using xkill in a script:

WINDOWID=` xwininfo -stats -int -name "My Child Window" | grep "Window id" | awk '{print $4;}' `

xkill -id "WINDOWID"

but this also killed the parent window that created "My Child Window" and thus my application.

How can I just kill the Child window?


SciYro 03-08-2007 12:28 PM

If you close the child window, and the parent closes, then its because the application is programed to behave as such. Since your resorting to fancy shell scripts, ill assume you already tried the old fashioned click-the-big-x-in-the-window-titlebar to close it, so the application must be programed to behave as such.

EmeryUWMC 03-08-2007 01:49 PM

Click-the-big-x-in-the-window-titlebar works, but I need to be able to automatically do this from another program which has the ability to run shell scripts.

I modified xkill by replacing XKillClient with XDestroyWindow which worked to kill only the child window, but now when I try to re-open the same child window that I killed I get the xerror "BadWindow" and it wont open.

SciYro 03-08-2007 09:10 PM

BadWindow only comes when you try to use a non-existent window, if the application was unaware of the destroyed window, then that could trigger it.

Umm, i haven't programed in Xlib for a long time, but isn't there another way to close windows? A way that lets the application handle the request? Something like XCloseWindow?

That or you could get your window manager (if you have a scriptable window manager) to perform the actions you want.

All times are GMT -5. The time now is 04:45 AM.