Anyone got an idea how to get from an Xserver the list of all open windows?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
From the CLI you can use
xwininfo -tree -root
If you need to do this within your own code then you need to use the XQueryTree
function from the Xlib
library.
回答2:
You can also take a look at the _NET_CLIENT_LIST
value of the root window. This is set by most modern window managers:
xprop -root|grep ^_NET_CLIENT_LIST
That value can easily be obtained programmatically, see your Xlib documentation!