启动应用程序时如何分配 WM_CLASS

启动应用程序时如何分配 WM_CLASS

我正在使用 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 分配给该窗口?

答案1

根据我上面的评论确认。查看项目源代码时,可以看到“Platform”下有多个文件夹。在X11文件夹中,可以找到源码如下:

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

GL 平台文件夹中不存在该文件。如果您想要为该平台设置属性,则需要向开发人员提交增强请求。

答案2

您可以使用 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"

相关内容