Window id of xterm started

Carsten Haitzler raster at rasterman.com
Mon Feb 12 11:58:00 UTC 2024


On Mon, 12 Feb 2024 14:06:36 +0300 Riza Dindir <riza.dindir at gmail.com> said:

> I ended up giving that xterm a distinct title. Using "xterm -T
> <some-distinct-title>". Then with the xdotool could find its id "xdotool
> search -name <some-distinct-title>".

very unreliable. title may be changed at any point before or after window
creation... you're asking for a race condition here.

> On Mon, Feb 12, 2024 at 2:02 PM Carsten Haitzler <raster at rasterman.com>
> wrote:
> 
> > On Sat, 10 Feb 2024 15:53:39 +0300 Riza Dindir <riza.dindir at gmail.com>
> > said:
> >
> > > Hello,
> > >
> > > I am starting xterm in my xinitrc. Is it possible to get the window id of
> > > that xterm?
> > >
> > > Regards
> >
> > echo $WINDOWID
> >
> > (in the xterm itself).
> >
> > But I suspect this is not what you want... and no - there is no reliable
> > way of
> > getting a window id from some app you ran - the window ID is runtime
> > assigned
> > and can be anything. An app can open multiple windows (and often creates
> > invisible windows you never see and sub windows etc.
> >
> > A large number of apps will set a _NET_WM_PID property on the window with
> > the
> > PID of the process that created the window - but not all. xterm does do
> > this.
> > Apps may set the WM_COMMAND property with the command that launched them
> > (and
> > any arguments). WM_CLASS may provide some hints as to the app that owns the
> > window. you might have to follow the breadcrumbs and look at the window id
> > referenced by WM_CLIENT_LEADER to get some of these properties.
> >
> >
> > --
> > ------------- Codito, ergo sum - "I code, therefore I am" --------------
> > Carsten Haitzler - raster at rasterman.com
> >
> >


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - raster at rasterman.com



More information about the xorg mailing list