是否有可能获得活动窗口& X11/Xlib中的可执行文件名称? [英] Is it possible to get active window & executable names in X11/Xlib?

查看:77
本文介绍了是否有可能获得活动窗口& X11/Xlib中的可执行文件名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看Windows/mac的RescueTime之后,似乎有一个适用于linux的版本,但似乎不是最新的.另外,这是周末,我想花时间玩X11.

我正在考虑制作一个简单的生产力轮询应用程序,每个短时间间隔轮询活动窗口,并拦截(并传递)鼠标和键盘按键来测量生产力.

这有可能吗?在检查了Xlib之后,我不知道在哪里可以找到可执行文件的二进制名称.等

解决方案

不一定可以在X中找到PID(并通过扩展扩展可执行的可执行文件)(由于该窗口甚至可能不属于某个窗口)在当前框上进行处理.

请参见获取最顶部窗口的pid和详细信息如何从进程ID获取X11窗口?在少数情况下可能有效的解决方案(通过查询_NET_WM_PID属性).

After looking at RescueTime for windows/mac, it seems that there's a version for linux but doesn't seem up to date. Also, it's the weekends and I want to spend time playing with X11..

I'm thinking of making a simple productivity-polling app, that every short interval polls the active windows, and intercepts (and passes along) mouse and keyboard presses to measure productivity.

Is this possible at all? After checking Xlib I'm at a loss on where to find the binary name of an executable. etc.

解决方案

Finding the PID (and by extension the backing executable) in X isn't necessarily possible (due to the fact that the window might not even be owned by a process on your current box).

See Getting pid and details for topmost window or How to get an X11 Window from a Process ID? for a solution which might work in a limited set of cases (by querying for the _NET_WM_PID property).

这篇关于是否有可能获得活动窗口& X11/Xlib中的可执行文件名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆