Set class name on menu window
authorOmar Sandoval <osandov@osandov.com>
Fri, 3 Nov 2017 16:49:10 +0000 (09:49 -0700)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Fri, 3 Nov 2017 19:41:03 +0000 (20:41 +0100)
WM_CLASS is a standard ICCCM property which is used to identify windows.
Window managers and compositors use it to allow per-application
configurable behavior.

dmenu.c

diff --git a/dmenu.c b/dmenu.c
index d605ab4..85e5060 100644 (file)
--- a/dmenu.c
+++ b/dmenu.c
@@ -545,6 +545,7 @@ setup(void)
        XIM xim;
        Window w, dw, *dws;
        XWindowAttributes wa;
+       XClassHint ch = {"dmenu", "dmenu"};
 #ifdef XINERAMA
        XineramaScreenInfo *info;
        Window pw;
@@ -613,6 +614,7 @@ setup(void)
        win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0,
                            CopyFromParent, CopyFromParent, CopyFromParent,
                            CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
+       XSetClassHint(dpy, win, &ch);
 
        /* open input methods */
        xim = XOpenIM(dpy, NULL, NULL, NULL);