[hackers] [slock][PATCH] Set window class hint (WM_CLASS) to "Slock"

From: Pierre Carru <pierre.carru_AT_gmail.com>
Date: Wed, 6 Jun 2018 14:24:58 +0200

---
Set a window class to slock windows so that window managers, compositors
and other tools can identify them.
Example usage with the compton compositor: add the "Slock" class to the
'fade-exclude' list so that slock appears immediately instead of being
faded in.
 slock.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/slock.c b/slock.c
index 5ae738c..d0d478f 100644
--- a/slock.c
+++ b/slock.c
_AT_@ -228,6 +228,7 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
 	XColor color, dummy;
 	XSetWindowAttributes wa;
 	Cursor invisible;
+	XClassHint class_hint = { "slock", "Slock" };
 
 	if (dpy == NULL || screen < 0 || !(lock = malloc(sizeof(struct lock))))
 		return NULL;
_AT_@ -251,6 +252,9 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
 	                          CopyFromParent,
 	                          DefaultVisual(dpy, lock->screen),
 	                          CWOverrideRedirect | CWBackPixel, &wa);
+
+	XSetClassHint(dpy, lock->win, &class_hint);
+
 	lock->pmap = XCreateBitmapFromData(dpy, lock->win, curs, 8, 8);
 	invisible = XCreatePixmapCursor(dpy, lock->pmap, lock->pmap,
 	                                &color, &color, 0, 0);
-- 
2.17.0
Received on Wed Jun 06 2018 - 14:24:58 CEST

This archive was generated by hypermail 2.3.0 : Wed Jun 06 2018 - 14:36:19 CEST