[hackers] [dmenu] [PATCH] Set class name on menu window

From: Omar Sandoval <osandov_AT_osandov.com>
Date: Thu, 2 Nov 2017 02:10:35 -0700

This is useful for, e.g., compton.
---
 dmenu.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/dmenu.c b/dmenu.c
index d605ab4..2a16ad8 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -545,6 +545,7 @@ setup(void)
 	XIM xim;
 	Window w, dw, *dws;
 	XWindowAttributes wa;
+	XClassHint *ch;
 #ifdef XINERAMA
 	XineramaScreenInfo *info;
 	Window pw;
_AT_@ -613,6 +614,13 @@ setup(void)
 	win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0,
 	                    CopyFromParent, CopyFromParent, CopyFromParent,
 	                    CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
+	ch = XAllocClassHint();
+	if (ch) {
+		ch->res_name = "dmenu";
+		ch->res_class = "dmenu";
+		XSetClassHint(dpy, win, ch);
+		XFree(ch);
+	}
 
 	/* open input methods */
 	xim = XOpenIM(dpy, NULL, NULL, NULL);
-- 
2.15.0
Received on Thu Nov 02 2017 - 10:10:35 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 02 2017 - 10:12:30 CET