diff -up ./config.def.h ../config.def.h --- ./config.def.h 2025-04-15 00:55:12.710000000 -0400 +++ ../config.def.h 2025-04-15 00:55:54.790000000 -0400 @@ -10,3 +10,6 @@ static const int failonclear = 1; /* size of square in px */ static const int squaresize = 50; + +/* spacing between squares in px */ +static const int squarespacing = 10; diff -up ./slock.c ../slock.c --- ./slock.c 2025-04-15 00:55:12.710000000 -0400 +++ ../slock.c 2025-04-15 00:54:09.660000000 -0400 @@ -130,7 +130,7 @@ gethash(void) static void draw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, - unsigned int color) + unsigned int len, unsigned int color) { int screen, crtc; XRRCrtcInfo* rrci; @@ -145,14 +145,19 @@ draw(Display *dpy, struct xrandr *rr, st locks[screen]->rrsr, locks[screen]->rrsr->crtcs[crtc]); /* skip disabled crtc */ - if (rrci->noutput > 0) - XFillRectangle(dpy, - locks[screen]->win, - locks[screen]->gc, - rrci->x + (rrci->width - squaresize) / 2, - rrci->y + (rrci->height - squaresize) / 2, - squaresize, - squaresize); + if (rrci->noutput > 0) { + if (len < 1) + len = 1; + int xoffset = (int) ((squaresize * len) + squarespacing * (len - 1)) / 2; + for (int i = 0; i < len; i++) + XFillRectangle(dpy, + locks[screen]->win, + locks[screen]->gc, + rrci->x - xoffset + ((rrci->width - squaresize) / 2 ) + ((squaresize + squarespacing) * i), + rrci->y + (rrci->height - squaresize) / 2, + squaresize, + squaresize); + } XRRFreeCrtcInfo(rrci); } } @@ -172,7 +177,7 @@ readpw(Display *dpy, struct xrandr *rr, { XRRScreenChangeNotifyEvent *rre; char buf[32], passwd[256], *inputhash; - int num, screen, running, failure, oldc; + int num, screen, running, failure; unsigned int len, color; KeySym ksym; XEvent ev; @@ -180,7 +185,6 @@ readpw(Display *dpy, struct xrandr *rr, len = 0; running = 1; failure = 0; - oldc = INIT; while (running && !XNextEvent(dpy, &ev)) { if (ev.type == KeyPress) { @@ -230,9 +234,8 @@ readpw(Display *dpy, struct xrandr *rr, break; } color = len ? INPUT : ((failure || failonclear) ? FAILED : INIT); - if (running && oldc != color) { - draw(dpy, rr, locks, nscreens, color); - oldc = color; + if (running) { + draw(dpy, rr, locks, nscreens, len, color); } } else if (rr->active && ev.type == rr->evbase + RRScreenChangeNotify) { rre = (XRRScreenChangeNotifyEvent*)&ev; @@ -428,7 +431,7 @@ main(int argc, char **argv) { } /* draw the initial rectangle */ - draw(dpy, &rr, locks, nscreens, INIT); + draw(dpy, &rr, locks, nscreens, 0, INIT); /* everything is now blank. Wait for the correct password */ readpw(dpy, &rr, locks, nscreens, hash);