我正在尝试获取窗口“A:流体流动(Fluent)-网格”的 PID在这张图片的右侧。我找到的命令如下。单击窗口后,它们不起作用。我想关闭来自左侧窗口“Test02 - workbench”的右侧窗口,而不关闭两个窗口。通过双击位于右侧窗口的 Geometry 和 Setup 之间的 Mesh 可获得右侧窗口。但是,我能够获取左侧窗口的 PID。
$ xprop _NET_WM_PID
_NET_WM_PID: not found.
$ xprop _NET_WM_PID | cut -d' ' -f3
not
$ xprop
_NET_WM_ICON_GEOMETRY(CARDINAL) = 5, 694, 54, 54
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 28, 0
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
_NET_WM_DESKTOP(CARDINAL) = 0
_NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_VERT
WM_CLASS(STRING) = "Ansyswbu.exe", "MainWin"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
specified location: 706, 52
program specified location: 706, 52
user specified size: 660 by 716
program specified size: 660 by 716
program specified minimum size: 2 by 2
program specified maximum size: 1356 by 734
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, WM_STATE, WM_CLASS, _MOTIF_WM_MESSAGES
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
bitmap id # to use for icon: 0x4600122
bitmap id # of mask for icon: 0x4600120
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_STICK, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW
WM_ICON_NAME(STRING) = "A : Fluid Flow (Fluent) - Meshing [ANSYS Academic Research]"
WM_NAME(STRING) = "A : Fluid Flow (Fluent) - Meshing [ANSYS Academic Research]"
_MW_WINDOW_HANDLE_0027d74c_v2(STRING) = "\002", "\003\013"
$ wmctrl -mlpx
...
0x0380000f 0 5159 . mymachine Test02 - Workbench
0x046000a4 0 0 Ansyswbu.exe.MainWin N/A A : Fluid Flow (Fluent) - Meshing [ANSYS Academic Research]
...
最后一条命令 wmctrl -mlpx 好像左边窗口的 PID 是 5159,右边窗口的 PID 是 0,怎么会是 0 呢?
谢谢。
答案1
它与 wmctrl 和窗口 id 一起工作。
首先,如果您没有安装 wmctrl,请安装它:
sudo apt-get install wmctrl
其次,使用以下命令查找窗口 ID:
$ wmctrl -mlpx
...
0x046000a4 0 0 Ansyswbu.exe.MainWin N/A A : Fluid Flow (Fluent) - Meshing [ANSYS Academic Research]
...
最后,用零 PID 杀死野兽控制端:
wmctrl -ic 0x046000a4
答案2
您想要的命令是:
xprop | grep _NET_WM_PID