Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get X window id from process in bash

Tags:

bash

xorg

Is there any bash tool/warper that could tell which x window(s) has been created by specific process ?

like image 596
grinchfox Colinsgrove Avatar asked Nov 07 '25 12:11

grinchfox Colinsgrove


2 Answers

wmctrl -lp

gives me the windows and their PIDs. Sample output:

0x04c00022  0 2168   ciro ciro.santilli - Skype™
0x03c00014  0 2154   ciro Krusader
0x03200022  0 2181   ciro Guake!
...

As mentioned, you can use command line tools like wmctrl or xprop. Well behaved clients should set _NET_WM_PID property to be pid of the process which created main window (all popular toolkits do this for you). Note that some clients don't set it or may be on another physical machine (you can use WM_CLIENT_MACHINE property) - so use this information as a hint and don't rely on it to be present or accurate. See emwh spec at freedesktop for reference.

like image 37
Andrey Sidorov Avatar answered Nov 09 '25 09:11

Andrey Sidorov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!