On Mon, 12 Feb 2024 19:02:13 +0300 Riza Dindir <riza.din...@gmail.com> said:
> Ok what would be a reliable way of doing this. Your best bet is the netwm pid. you can get the pid of xterm after you run it.. you can match this with the netwm pid property - that is pretty close to 100% reliable (some exceptions... not in your case). > On Mon, Feb 12, 2024, 14:58 Carsten Haitzler <ras...@rasterman.com> wrote: > > > On Mon, 12 Feb 2024 14:06:36 +0300 Riza Dindir <riza.din...@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 <ras...@rasterman.com> > > > wrote: > > > > > > > On Sat, 10 Feb 2024 15:53:39 +0300 Riza Dindir <riza.din...@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 - ras...@rasterman.com > > > > > > > > > > > > > > -- > > ------------- Codito, ergo sum - "I code, therefore I am" -------------- > > Carsten Haitzler - ras...@rasterman.com > > > > -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- Carsten Haitzler - ras...@rasterman.com