Window id of xterm started

Carsten Haitzler raster at rasterman.com
Mon Feb 12 11:01:30 UTC 2024


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



More information about the xorg mailing list