[hackers] [dwm][PATCH v2] Set class name on status bar

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

This is useful for, e.g., compton.
---
Forgot to check for a NULL return in the last one.
 dwm.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/dwm.c b/dwm.c
index 4782343..6f56447 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -1809,6 +1809,11 @@ updatebars(void)
 		.background_pixmap = ParentRelative,
 		.event_mask = ButtonPressMask|ExposureMask
 	};
+	XClassHint *ch = XAllocClassHint();
+	if (ch) {
+		ch->res_name = "dwmstatus";
+		ch->res_class = "dwm";
+	}
 	for (m = mons; m; m = m->next) {
 		if (m->barwin)
 			continue;
_AT_@ -1817,7 +1822,10 @@ updatebars(void)
 				CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
 		XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
 		XMapRaised(dpy, m->barwin);
+		if (ch)
+			XSetClassHint(dpy, m->barwin, ch);
 	}
+	XFree(ch);
 }
 
 void
-- 
2.15.0
Received on Thu Nov 02 2017 - 10:07:18 CET

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