Xorg

啟動應用程序時如何分配 WM_CLASS

  • January 17, 2019

我正在使用 mupdf-gl,並且使用xprop我沒有得到WM_CLASS. 但如果我使用 mupdf-x11,我會得到WM_CLASS.

mupdf-gl 的 xprop 的輸出:

_NET_WM_DESKTOP(CARDINAL) = 2
_NET_WM_STATE(ATOM) =
WM_STATE(WM_STATE):
               window state: Normal
               icon window: 0x0
_NET_WM_PID(CARDINAL) = 12656
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_HINTS(WM_HINTS):
               Initial state is Normal State.
WM_NORMAL_HINTS(WM_SIZE_HINTS):
               user specified size: 1088 by 1668
WM_CLIENT_MACHINE(STRING) = "elariel"
WM_ICON_NAME(STRING) = "EEE Transformer CT.pdf - 1 / 4"
WM_NAME(STRING) = "EEE Transformer CT.pdf - 1 / 4"

mupdf-x11 的 xprop 的輸出:

WM_STATE(WM_STATE):
               window state: Normal
               icon window: 0x0
_NET_WM_DESKTOP(CARDINAL) = 2
_NET_WM_NAME(UTF8_STRING) = "EEE Transformer CT.pdf - 1/4 (96 dpi)"
WM_LOCALE_NAME(STRING) = "C"
WM_CLIENT_MACHINE(STRING) = "elariel"
WM_ICON_NAME(STRING) = "EEE Transformer CT.pdf - 1/4 (96 dpi)"
WM_NAME(STRING) = "EEE Transformer CT.pdf - 1/4 (96 dpi)"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW
WM_CLASS(STRING) = "mupdf", "MuPDF"
WM_HINTS(WM_HINTS):
               bitmap id # to use for icon: 0x2800091
               bitmap id # of mask for icon: 0x2800093

啟動時如何將 WM_CLASS 分配給視窗?

根據我上面的評論確認。查看項目原始碼時,可以看到“Platform”下有多個文件夾。在X11文件夾中,可以找到原始碼如下:

if (classhint)
{
   classhint->res_name = "mupdf";
   classhint->res_class = "MuPDF";
   XSetClassHint(xdpy, xwin, classhint);
   XFree(classhint);
}

這在 GL 平台文件夾中不存在。如果您想要為該平台設置屬性,則需要向開發人員送出增強請求。

您可以使用 xprop 設置屬性。

xprop -name "ma_window" -f WM_TRUC 8s -set WM_TRUC "The_Truc"

xprop -name "ma_window" WM_TRUC
WM_TRUC(STRING) = "The_Truc"

引用自:https://unix.stackexchange.com/questions/495053