Get an X window ID

Carsten Haitzler (The Rasterman) raster at
Thu May 17 16:36:44 PDT 2007

On Thu, 17 May 2007 11:46:45 -0700 Alan Coopersmith <alan.coopersmith at>

i would agree here - though if we were to do this i'd advocate setting
_NET_WM_PID as well as WM_CLIENT_MACHINE and _NET_STARTUP_ID. the question is -
do we want to transport the protocol for the property set's for every create of
a window? sure we can do a heuristic and limit it to creates of windows that
are immediate children of root and to reparent requests when the new parent is
root - but even then? maybe we want to send these properties once only on
connect and have the server itself set these by default on all windows created
by that client - avoiding the extra protocol? this would imply an extension of
some sort will be needed (and xlib/xcb would quietly use the extension if it
were available).

it would be nice to be able to trust that these properties would be more
"guaranteed" (especially startup id - given startup id you can track that
back to pid, etc. as long as the wm did the launch or whoever did the launch
of the process advertises this info).

> Daniel Stone wrote:
> > On Thu, May 17, 2007 at 11:00:33AM -0500, Pat Kane wrote:
> >> Are you allowed to change Xlib and the X server?
> >>
> >> If so then this hack might help.
> >>
> >> A while ago I needed to know, from inside the X server,
> >> the PID of a process that created an X connection.
> >>
> >> I used spare pad bytes in the  xConnClientPrefix initial
> >> connection setup message to pass the PID from the client
> >> to the X server.  Note that clients might not be on the
> >> same machine so you also need the hostname of the client.
> > 
> > NetWM already allows you to use properties to encode the pid and
> > hostname of clients as window properties.
> Should we have Xlib or xcb automatically set these so that
> we don't have to wait for every application and toolkit to
> be modified to do so?
> -- 
> 	-Alan Coopersmith-           alan.coopersmith at
> 	 Sun Microsystems, Inc. - X Window System Engineering
> _______________________________________________
> 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