LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-07-2007, 06:38 PM   #1
EmeryUWMC
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
Question 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?

Thanks
 
Old 03-08-2007, 11:28 AM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
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.
 
Old 03-08-2007, 12:49 PM   #3
EmeryUWMC
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
Old 03-08-2007, 08:10 PM   #4
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
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.
 
  


Reply

Tags
x11


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gnome kill/destroy window keystroke? Pathian Linux - Newbie 5 10-20-2011 02:14 PM
How to kill a Child and all its subsequent child process in C shayer009 Programming 3 12-04-2007 12:40 AM
kill process and its child in a shell dalmassoc Linux - Software 4 03-03-2006 01:57 AM
open new window for every child folder? nitroguy Fedora 5 09-19-2005 09:33 PM
When I kill parent process, child isn't killed BengeBoy Linux - Software 0 08-19-2004 04:38 PM


All times are GMT -5. The time now is 01:02 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration