How do I get the window ID of the frontmost window in X11
How do I get the window ID of the frontmost window in X11
- Subject: How do I get the window ID of the frontmost window in X11
- From: Sven Nueesch <email@hidden>
- Date: Tue, 15 Jul 2003 11:14:11 +0200
Thanks a lot to you all for the great solutions!
from Tom:
Try "xprop", maybe something like:
xprop -root|grep "_NET_CLIENT_LIST_STACKING(WINDOW): window id"|cut -d\
-f 5
from Adrian:
If you know the title of the specific X11 window you want, and it is
unique, then you can simply 'grep' for it in the above list. Something
like:
xwininfo -root -tree | grep "my-window-title"
So, integrating this all with xwd, sending the resulting dump out to a
file called "dumpfile.xwd", gives something like:
xwd -id `xwininfo -root -tree | grep "my-window-title" | awk '{ print
$1 }'` > dumpfile.xwd
what I figured out:
xwd -id `xprop -root |nawk '/_NET_ACTIVE_WINDOW/ {print $5; exit;}'`
from Sean (not what I was looking for but true of course):
However, you don't have to specify the -id option to xwd. You can just
type
"xwd > file" and xwd will have you choose the window with your cursor.
Enjoy work. Be happy!
Sven
I need to do an automatic dump of the frontmost X window of
commercial application to a printer. I thought about using xwd which
has an option -id <Window-ID>. But how do I get the window id of the
frontmost window without modifying the running applications? Is there
a commandline tool to do this? Can anybody help me?
Thanks
Sven
Enjoy work. Be happy!
Sven
Winmail.dat is not sexy: See:
http://www.modemhelp.net/newsletter/email/winmaildat.shtml
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/x11-users
X11 for Mac OS X FAQ: http://developer.apple.com/qa/qa2001/qa1232.html
Report issues, request features, feedback: http://developer.apple.com/bugreporter
Do not post admin requests to the list. They will be ignored.