commit 12e4afe93ceb18e99a0836580b481454ba0b179d
parent 916aac66354c97c87809d8381837ab96abfd55a3
Author: regexghost <dev@regexghost.com>
Date: Fri, 19 Jun 2026 00:37:18 +0100
foreground image only when typing
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -22,4 +22,3 @@ static const int imgwidth = 256;
static const int imgheight = 256;
static const int imgoffsetx = 832;
static const int imgoffsety = 412;
-static const int showimgonlyatstart = 1;
diff --git a/slock.c b/slock.c
@@ -154,6 +154,8 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
KeySym ksym;
XEvent ev;
+ memset(passwd, 0, sizeof(passwd));
+
len = 0;
running = 1;
failure = 0;
@@ -218,8 +220,11 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
else
XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[0]);
XClearWindow(dpy, locks[screen]->win);
- if (showimgonlyatstart != 1)
- showimage(dpy, locks[screen]->win);
+
+ if (strlen(passwd) > 0) {
+ showimage(dpy, locks[screen]->win);
+ }
+
}
oldc = color;
}
@@ -295,8 +300,6 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
&color, &color, 0, 0);
XDefineCursor(dpy, lock->win, invisible);
- showimage(dpy, lock->win);
-
/* Try to grab mouse pointer *and* keyboard for 600ms, else fail the lock */
for (i = 0, ptgrab = kbgrab = -1; i < 6; i++) {
if (ptgrab != GrabSuccess) {