Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently working with Xvfb to grab the screenshots of my programs. Is there a way to determine the number and the names of the windows that are currently "displayed" in Xvfb?

Where can I find more documentation on this?

share|improve this question

If you run a window manager on the Xvfb display, you can use whatever features it has to list window information.

On the command line, wmctrl can show some window information.

DISPLAY=:1 wmctrl -l
share|improve this answer

xwininfo -root -tree

See the xwininfo man page for more information.

share|improve this answer
Thanks a lot. It is a very useful information. Do you know a way to get these information in C/C++ (without parsing the command outputs) ? – Heinrich Nov 3 '10 at 13:10
You could call XQueryTree yourself, as the older versions of xwininfo do, or the xcb equivalents as the new versions do. – alanc Nov 3 '10 at 14:18
Do you think it is an advantage to use xcb? As far as I read it's a low level access to the X11 protocol. Also, the API doesn't look as comfortable as using the X11 libs. – Heinrich Nov 3 '10 at 16:10
Well, I did when I modified xwininfo to use xcb, but that was as much to serve as an xcb example & test code as for the actual benefits. blogs.sun.com/alanc/entry/porting_xwininfo_to_xcb has a much longer explanation than I can provide here. – alanc Nov 3 '10 at 20:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.