无法从特定窗口识别应用信息

无法从特定窗口识别应用信息

我尝试找出窗口冻结的来源,但没有成功:

[andrii@andrii-Aspire-A517-51G ~]$ xprop | awk -F'=' '/_NET_WM_PID/ {print $2}' | xargs ps
    PID TTY          TIME CMD
   8434 pts/0    00:00:00 bash
 967972 pts/0    00:00:00 xargs
 967991 pts/0    00:00:00 ps
[andrii@andrii-Aspire-A517-51G ~]$ xprop | awk -F'=' '/_NET_WM_PID/ {print $2}' 

[andrii@andrii-Aspire-A517-51G ~]$ 

应用程序

此外,此^应用程序跳过任务栏。

在此处输入图片描述

cat /etc/os-release

NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
wmctrl -l -p -x
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  20 (X_GetProperty)
  Resource id in failed request:  0x6a0bec9
  Serial number of failed request:  13
  Current serial number in output stream:  13

$  wmctrl -m
Name: Openbox
Class: 
PID: N/A
Window manager's "showing the desktop" mode: OFF

$ env | grep -i desktop
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session2
DESKTOP_SESSION=plasma
XDG_SESSION_DESKTOP=plasma
XDG_CURRENT_DESKTOP=KDE
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_DATA_DIRS=/usr/share/plasma:/home/andrii/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop

$
xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x44185cd (has no name)

  Root window id: 0x9a4 (the root window) (has no name)
  Parent window id: 0x9a4 (the root window) (has no name)
     55 children:
     0x4418619 (has no name): ()  1x1+0+0  +401+244
     0x4418618 (has no name): ()  1x1+0+0  +401+244
     0x4418617 (has no name): ()  1x1+0+0  +401+244
     0x4418616 (has no name): ()  1x1+0+0  +401+244
     0x4418615 (has no name): ()  1x1+0+0  +401+244
     0x4418614 (has no name): ()  1x1+0+0  +401+244
     0x4418613 (has no name): ()  1x1+0+0  +401+244
     0x4418612 (has no name): ()  1x1+0+0  +401+244
     0x4418611 (has no name): ()  1x1+0+0  +401+244
     0x4418610 (has no name): ()  1x1+0+0  +401+244
     0x441860f (has no name): ()  1x1+0+0  +401+244
     0x441860e (has no name): ()  1x1+0+0  +401+244
     0x441860d (has no name): ()  1x1+0+0  +401+244
     0x441860c (has no name): ()  1x1+0+0  +401+244
     0x441860b (has no name): ()  1x1+0+0  +401+244
     0x441860a (has no name): ()  1x1+0+0  +401+244
     0x4418609 (has no name): ()  1x1+0+0  +401+244
     0x4418608 (has no name): ()  1x1+0+0  +401+244
     0x4418607 (has no name): ()  1x1+0+0  +401+244
     0x4418606 (has no name): ()  1x1+0+0  +401+244
     0x4418605 (has no name): ()  1x1+0+0  +401+244
     0x4418604 (has no name): ()  1x1+0+0  +401+244
     0x4418603 (has no name): ()  1x1+0+0  +401+244
     0x4418602 (has no name): ()  1x1+0+0  +401+244
     0x4418601 (has no name): ()  1x1+0+0  +401+244
     0x4418600 (has no name): ()  1x1+0+0  +401+244
     0x44185ff (has no name): ()  1x1+0+0  +401+244
     0x44185fe (has no name): ()  1x1+0+0  +401+244
     0x44185fd (has no name): ()  1x1+0+0  +401+244
     0x44185fc (has no name): ()  1x1+0+0  +401+244
     0x44185fb (has no name): ()  1x1+0+0  +401+244
     0x44185fa (has no name): ()  1x1+0+0  +401+244
     0x44185f9 (has no name): ()  26x1+1891+1043  +2292+1287
     0x44185f8 (has no name): ()  26x1+1891+1038  +2292+1282
     0x44185f7 (has no name): ()  1x25+1917+1019  +2318+1263
     0x44185f6 (has no name): ()  26x1+1+1043  +402+1287
     0x44185f5 (has no name): ()  26x1+1+1038  +402+1282
     0x44185f4 (has no name): ()  1x25+0+1019  +401+1263
     0x44185f3 (has no name): ()  1864x1+27+1043  +428+1287
     0x44185f2 (has no name): ()  1864x1+27+1038  +428+1282
     0x44185ed (has no name): ()  1916x4+1+1039  +402+1283
        4 children:
        0x44185f1 (has no name): ()  1x4+1890+0  +2292+1283
        0x44185f0 (has no name): ()  1x4+25+0  +427+1283
        0x44185ef (has no name): ()  25x4+1891+0  +2293+1283
        0x44185ee (has no name): ()  25x4+0+0  +402+1283
     0x44185e5 (has no name): ()  1x994+1917+26  +2318+270
     0x44185e4 (has no name): ()  1x994+0+26  +401+270
     0x44185de (has no name): ()  1916x1+1+23  +402+267
     0x44185dd (has no name): ()  1x25+1917+1  +2318+245
     0x44185dc (has no name): ()  26x1+1892+0  +2293+244
     0x44185db (has no name): ()  26x1+0+0  +401+244
     0x44185da (has no name): ()  1866x1+26+0  +427+244
     0x44185d9 (has no name): ()  1x25+0+1  +401+245
     0x44185d8 (has no name): ()  1916x22+1+1  +402+245
        12 children:
        0x44185ec (has no name): ()  18x18+1856+2  +2258+247
        0x44185eb (has no name): ()  20x20+2+1  +404+246
        0x44185ea (has no name): ()  18x18+0+0  +402+245
        0x44185e9 (has no name): ()  18x18+0+0  +402+245
        0x44185e8 (has no name): ()  18x18+1896+2  +2298+247
        0x44185e7 (has no name): ()  18x18+1876+2  +2278+247
        0x44185e6 (has no name): ()  1792x20+62+1  +464+246
        0x44185e3 (has no name): ()  2x22+1914+0  +2316+245
        0x44185e2 (has no name): ()  25x2+1891+0  +2293+245
        0x44185e1 (has no name): ()  2x22+0+0  +402+245
        0x44185e0 (has no name): ()  25x2+0+0  +402+245
        0x44185df (has no name): ()  1866x2+25+0  +427+245
     0x44185d3 (has no name): ()  1916x1+1+1037  +402+1281
        2 children:
        0x44185d5 (has no name): ()  26x1+1890+0  +2292+1281
        0x44185d4 (has no name): ()  26x1+0+0  +402+1281
     0x44185d2 (has no name): ()  1x1012+1916+25  +2317+269
        1 child:
        0x44185d7 (has no name): ()  1x18+0+994  +2317+1263
     0x44185d1 (has no name): ()  1916x1+1+24  +402+268
     0x44185d0 (has no name): ()  1x1012+1+25  +402+269
        1 child:
        0x44185d6 (has no name): ()  1x18+0+994  +402+1263
     0x44185ce (has no name): ()  1914x1012+2+25  +403+269
        1 child:
        0x44185cf (has no name): ()  1914x1012+0+0  +403+269

  Absolute upper-left X:  401
  Absolute upper-left Y:  244
  Relative upper-left X:  401
  Relative upper-left Y:  244
  Width: 1918
  Height: 1044
  Depth: 24
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +401+244  --399+244  --399--208  +401--208
  -geometry 1918x1044+401+244

  Bit gravity: ForgetGravity
  Window gravity: NorthWestGravity
  Backing-store hint: NotUseful
  Backing-planes to be preserved: 0xffffffff
  Backing pixel: 0
  Save-unders: No

  Someone wants these events:
      ButtonPress
      ButtonRelease
      EnterWindow
      LeaveWindow
      SubstructureRedirect
      FocusChange
  Do not propagate these events:
  Override redirection?: No

  No window manager hints defined
  Window manager hints:
      Process id: (unknown)

  No normal window size hints defined
  No zoom window size hints defined

  No window shape defined
  No border shape defined

更新。我 xkill 了这个窗口,这是ps faux前后的比较:

https://paste.ubuntu.com/p/2Rf9Kzjpw7/

https://paste.ubuntu.com/p/8rwZySP9Vc/

xwininfo -tree -root | pastebinit  

https://paste.ubuntu.com/p/krDy9QwDq3/

(定义 ID 0x44185cd)

 xprop -root|grep ^_NET_CLIENT_LIST | pastebinit 

https://paste.ubuntu.com/p/FVYhCzkkQj/

wmctrl -l | pastebinit                                                                                                                                                   3  12:57 
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  20 (X_GetProperty)
  Resource id in failed request:  0x6a0bec9
  Serial number of failed request:  13
  Current serial number in output stream:  13
You are trying to send an empty document, exiting.

xlsclients | pastebinit    

https://paste.ubuntu.com/p/4gsvZ75JVt/

答案1

这是对您的神秘窗口的两步识别。

识别 1a

您可以打开终端并使用

$ xwininfo

这将提示您选择要获取信息的窗口。获得窗口 ID WIN_ID(以及其他信息)后,您可以使用其他标志获取更多信息,或者使用wmctrl,请参阅识别 1b下面。特别是,您可能希望获取进程 ID。如果wmctrl这不起作用,您可以尝试PID使用WIN_ID

$ xprop -id <WIN_ID> | grep _NET_WM_PID            (or simply...)
$ xprop -id <WIN_ID> _NET_WM_PID

如果你不这样做,grep你可能会得到其他有趣的信息。根据我的经验,这并不总是能给你带来积极的结果。

也可以看看识别 2以下。

有关的

  1. https://unix.stackexchange.com/a/84981/137608
  2. https://stackoverflow.com/questions/1131277/how-to-convert-a-x11-window-id-to-a-process-id
  3. 通过窗口知道进程的 PID?
  4. https://ubuntuforums.org/archive/index.php/t-1124561.html

识别 1b

作为替代方案(可能更容易使用,但在你的情况下似乎不起作用),你可以打开终端并使用

$ wmctrl -l -p -x

列出当前窗口管理器管理的所有窗口(您可以使用wmctrl -m或检查它env | grep -i desktop,并且将该输出发布到 OP 中会很有用)。

wmctrl --help

The format of the window list:

  <window ID> <desktop ID> <client machine> <window title>

这是基本格式,使用 获得-l。选项-p-x添加额外列。输出的第 1 列(数字窗口 ID,来自基本选项-l)、第 3 列(PID 编号,来自选项-p)、第 4 列(WM_CLASS,来自选项-x)和第 5 列(窗口标题,来自基本选项-l)将最有用。

然后你可以使用

$ wmctrl -a <WIN>

对每个列出的窗口,选择“通过切换到其桌面并提升它来激活窗口”(选中)。这样,您就可以识别您的神秘窗口。

至于<WIN>:“此参数指定窗口。默认情况下,它被解释为字符串。该字符串与窗口标题匹配,并使用第一个匹配的窗口。匹配不区分大小写,字符串可能出现在标题的任何位置。”

<WIN>因此,对于上面第 5 列的任何子字符串,例如,使用 基本上没问题wmctrl -a 'Firefox'。您可能需要适当转义字符串。或者,您可以使用

$ wmctrl -a <window hex no.> -i

与上面的第 1 列(这避免了与窗口标题的字符串匹配可能产生的歧义),或者

$ wmctrl -a <WM_CLASS> -x

与上文第 4 列相同。

您可以尝试其他有趣且实用的选项,如-R-G

识别 2

对于pidno每个目标窗口,您可以使用

$ ps -ef | grep <pidno>
$ pwdx <pidno>
$ pidstat -p <pidno>
$ ls /proc/<pidno>
$ cat /proc/<pidno>/<file>

以进一步识别。您可以通过ls上文了解可以使用 的内容<file>,例如statuscmdline

资料来源:

  1. 如何查看给定 PID 的详细信息?
  2. https://superuser.com/questions/632979/if-i-know-the-pid-number-of-a-process-how-can-i-get-its-name

相关内容