使用 node-x11 库列出打开的 X 服务器 windows?

List opened X Server windows with node-x11 library?

我需要获取 Linux 下打开的 windows 列表。

我可以使用 node-x11 库列出所有打开的 xorg windows 吗?

我尝试使用 xlib 作为此库的 python 示例,但无法正常工作。

var x11 = require('../../lib');
x11.createClient(function(err, display) {
   console.log('succesfully connected to \"' + display.vendor + '\" server');
   console.log(display.client.QueryTree());
   display.client.terminate();
});

遇到错误。

events.js:72
       throw er; // Unhandled 'error' event
                  ^
Error: Bad window
    at ReadFixedRequest.callback

来自 WindowManager 示例:

var X, x11 = require('../lib');

x11.createClient(function(err, display) {
    X = display.client;
    root = display.screen[0].root;

    X.QueryTree(root, function(err, tree) {
        console.log(tree.children); //output all windows tree
    });
});