Get an X window ID

Carsten Haitzler (The Rasterman) raster at
Thu May 17 16:19:08 PDT 2007

On Thu, 17 May 2007 13:55:36 +0200 (CEST) eberrocal at

you are getting into a very complex world here. tracking window id(s) of a
process is not a simple 1:1 mapping and not guaranteed. it's at best a
heuristic (a guess) that may or may not work. if you are after a solid
guaranteed way to know the window ID... there is none (NB: in pure theory you
can force this  with ld_preloads but suid apps wont work with this, and
remember that 1 app can create many windows).

you are entering the land of what window managers do - get ready to learn a lot
of nasty bits about x very quickly. maybe you should go back to your design and
try and make this work without NEEDING the window id? i don't know what you are
doing, so not sure if that is an option.

> My problem is that I need to know the ID of an X window.
> I have a program that lunch other program with the typical fork() and
> after execl().
> I have the ID of the process but I need the ID of the window because I
> need to send X events to this window.
> There are any form to get the window ID of a program (of what I have his
> process ID) ??:
> Thanks for your time.
> Edu.
> _______________________________________________
> xorg mailing list
> xorg at

------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster at
Tokyo, Japan (東京 日本)

More information about the xorg mailing list