Anyone got an idea how to get from an Xserver the list of all open windows?
任何人都知道如何从Xserver获取所有打开的窗口列表?
2 个解决方案
#1
67
From the CLI you can use
从CLI可以使用
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.
如果您需要在自己的代码中执行此操作,则需要使用Xlib库中的XQueryTree函数。
#2
14
You can also take a look at the _NET_CLIENT_LIST
value of the root window. This is set by most modern window managers:
您还可以查看根窗口的_NET_CLIENT_LIST值。这是由大多数现代窗口管理器设置的:
xprop -root|grep ^_NET_CLIENT_LIST
That value can easily be obtained programmatically, see your Xlib documentation!
可以通过编程方式轻松获取该值,请参阅Xlib文档!
#1
67
From the CLI you can use
从CLI可以使用
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.
如果您需要在自己的代码中执行此操作,则需要使用Xlib库中的XQueryTree函数。
#2
14
You can also take a look at the _NET_CLIENT_LIST
value of the root window. This is set by most modern window managers:
您还可以查看根窗口的_NET_CLIENT_LIST值。这是由大多数现代窗口管理器设置的:
xprop -root|grep ^_NET_CLIENT_LIST
That value can easily be obtained programmatically, see your Xlib documentation!
可以通过编程方式轻松获取该值,请参阅Xlib文档!