根据窗口 ID 获取进程 ID

根据窗口 ID 获取进程 ID

当我在给定的 Windows ID 上运行xprop -id <wid>OpenGL 应用程序(Ubuntu 12.04)时,我得到了一堆属性,但我看不到_NET_WM_PID

$ xprop -id 0x4a00002 
_NET_WM_ICON_GEOMETRY(CARDINAL) = 0, 488, 64, 65
XKLAVIER_STATE(INTEGER) = 0, 0
_NET_WM_FULLSCREEN_MONITORS(CARDINAL) = 4294967295, 1852143205, 19456, 1645412352
_NET_WM_STATE(ATOM) = 
WM_STATE(WM_STATE):
        window state: Normal
        icon window: 0x0
_NET_FRAME_EXTENTS(CARDINAL) = 1, 1, 28, 1
_NET_WM_DESKTOP(CARDINAL) = 0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW
WM_LOCALE_NAME(STRING) = "C"
WM_HINTS(WM_HINTS):
        Initial state is Normal State.
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        user specified location: 50, 50
        user specified size: 640 by 480
WM_CLIENT_MACHINE(STRING) = "gliese-581h"
WM_ICON_NAME(STRING) = "Full-Screen & Windowed Mode"
WM_NAME(STRING) = "Full-Screen & Windowed Mode"

我如何访问与窗口 id 关联的进程 pid?

答案1

它适用于支持它的窗口:

$ xprop -id 0x0540019c| grep _NET_WM_PID
_NET_WM_PID(CARDINAL) = 25685

但并非所有人都能做到:

$ xprop -id 0x2000006| grep _NET_WM_PID
$

据我所知,没有办法访问此类窗口的 PID。

相关内容