<div dir="auto"><div>Ok what would be a reliable way of doing this.</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Mon, Feb 12, 2024, 14:58 Carsten Haitzler <<a href="mailto:raster@rasterman.com">raster@rasterman.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, 12 Feb 2024 14:06:36 +0300 Riza Dindir <<a href="mailto:riza.dindir@gmail.com" target="_blank" rel="noreferrer">riza.dindir@gmail.com</a>> said:<br>
<br>
> I ended up giving that xterm a distinct title. Using "xterm -T<br>
> <some-distinct-title>". Then with the xdotool could find its id "xdotool<br>
> search -name <some-distinct-title>".<br>
<br>
very unreliable. title may be changed at any point before or after window<br>
creation... you're asking for a race condition here.<br>
<br>
> On Mon, Feb 12, 2024 at 2:02 PM Carsten Haitzler <<a href="mailto:raster@rasterman.com" target="_blank" rel="noreferrer">raster@rasterman.com</a>><br>
> wrote:<br>
> <br>
> > On Sat, 10 Feb 2024 15:53:39 +0300 Riza Dindir <<a href="mailto:riza.dindir@gmail.com" target="_blank" rel="noreferrer">riza.dindir@gmail.com</a>><br>
> > said:<br>
> ><br>
> > > Hello,<br>
> > ><br>
> > > I am starting xterm in my xinitrc. Is it possible to get the window id of<br>
> > > that xterm?<br>
> > ><br>
> > > Regards<br>
> ><br>
> > echo $WINDOWID<br>
> ><br>
> > (in the xterm itself).<br>
> ><br>
> > But I suspect this is not what you want... and no - there is no reliable<br>
> > way of<br>
> > getting a window id from some app you ran - the window ID is runtime<br>
> > assigned<br>
> > and can be anything. An app can open multiple windows (and often creates<br>
> > invisible windows you never see and sub windows etc.<br>
> ><br>
> > A large number of apps will set a _NET_WM_PID property on the window with<br>
> > the<br>
> > PID of the process that created the window - but not all. xterm does do<br>
> > this.<br>
> > Apps may set the WM_COMMAND property with the command that launched them<br>
> > (and<br>
> > any arguments). WM_CLASS may provide some hints as to the app that owns the<br>
> > window. you might have to follow the breadcrumbs and look at the window id<br>
> > referenced by WM_CLIENT_LEADER to get some of these properties.<br>
> ><br>
> ><br>
> > --<br>
> > ------------- Codito, ergo sum - "I code, therefore I am" --------------<br>
> > Carsten Haitzler - <a href="mailto:raster@rasterman.com" target="_blank" rel="noreferrer">raster@rasterman.com</a><br>
> ><br>
> ><br>
<br>
<br>
-- <br>
------------- Codito, ergo sum - "I code, therefore I am" --------------<br>
Carsten Haitzler - <a href="mailto:raster@rasterman.com" target="_blank" rel="noreferrer">raster@rasterman.com</a><br>
<br>
</blockquote></div></div></div>