【问题标题】:List opened X Server windows with node-x11 library?使用 node-x11 库列出打开的 X Server 窗口?
【发布时间】:2015-09-04 02:47:11
【问题描述】:

我需要获取 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

【问题讨论】:

    标签: node.js x11 xlib


    【解决方案1】:

    来自 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
        });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多