From 1efc3eab51b5fbdaeca59495789d7d27981efebc Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sat, 13 Jun 2020 09:35:26 -0600 Subject: [PATCH] xmonad: patch slock to include window title needed for reliable focus exclusion from picom, so that screen contents aren't leaked while locked. --- overlays/slock.nix | 4 +++ .../misc/screensavers/slock/window_name.patch | 26 +++++++++++++++++++ profiles/graphical/xmonad/default.nix | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 overlays/slock.nix create mode 100644 pkgs/misc/screensavers/slock/window_name.patch diff --git a/overlays/slock.nix b/overlays/slock.nix new file mode 100644 index 00000000..d053b64c --- /dev/null +++ b/overlays/slock.nix @@ -0,0 +1,4 @@ +final: prev: { + slock = prev.slock.overrideAttrs + (o: { patches = [ ../pkgs/misc/screensavers/slock/window_name.patch ]; }); +} diff --git a/pkgs/misc/screensavers/slock/window_name.patch b/pkgs/misc/screensavers/slock/window_name.patch new file mode 100644 index 00000000..740b8213 --- /dev/null +++ b/pkgs/misc/screensavers/slock/window_name.patch @@ -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); diff --git a/profiles/graphical/xmonad/default.nix b/profiles/graphical/xmonad/default.nix index 1c5a7bca..49501440 100644 --- a/profiles/graphical/xmonad/default.nix +++ b/profiles/graphical/xmonad/default.nix @@ -20,7 +20,7 @@ inactiveOpacity = "0.8"; settings = { "unredir-if-possible" = true; - "focus-exclude" = "id = 0x2400001"; + "focus-exclude" = "name = 'slock'"; }; };