xmonad: patch slock to include window title

needed for reliable focus exclusion from picom, so that screen contents
aren't leaked while locked.
This commit is contained in:
Timothy DeHerrera 2020-06-13 09:35:26 -06:00
parent 8ae4b62d77
commit 1efc3eab51
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
3 changed files with 31 additions and 1 deletions

4
overlays/slock.nix Normal file
View File

@ -0,0 +1,4 @@
final: prev: {
slock = prev.slock.overrideAttrs
(o: { patches = [ ../pkgs/misc/screensavers/slock/window_name.patch ]; });
}

View File

@ -0,0 +1,26 @@
diff --git a/slock.c b/slock.c
index d2f0886..b0418f0 100644
--- a/slock.c
+++ b/slock.c
@@ -219,8 +219,13 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
struct lock *lock;
XColor color, dummy;
XSetWindowAttributes wa;
+ XTextProperty title;
+ char *name = "slock";
Cursor invisible;
+ if (XStringListToTextProperty(&name, 1, &title) == 0)
+ die("slock: out of memory\n");
+
if (dpy == NULL || screen < 0 || !(lock = malloc(sizeof(struct lock))))
return NULL;
@@ -243,6 +248,7 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
CopyFromParent,
DefaultVisual(dpy, lock->screen),
CWOverrideRedirect | CWBackPixel, &wa);
+ XSetWMName(dpy, lock->win, &title);
lock->pmap = XCreateBitmapFromData(dpy, lock->win, curs, 8, 8);
invisible = XCreatePixmapCursor(dpy, lock->pmap, lock->pmap,
&color, &color, 0, 0);

View File

@ -20,7 +20,7 @@
inactiveOpacity = "0.8";
settings = {
"unredir-if-possible" = true;
"focus-exclude" = "id = 0x2400001";
"focus-exclude" = "name = 'slock'";
};
};