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

我需要在Linux下获得打开的窗口列表。

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

我尝试使用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 }); });