slock

[fork] screen locker
Log | Files | Refs | README | LICENSE

commit fb66b0472b1059eab74a1a951c3cae8fb7147852
parent 83cd21ec743477af92e09d4b5cf3f89a1cf52da7
Author: hhvn <dev@hhvn.uk>
Date:   Tue,  8 Feb 2022 15:40:34 +0000

Rejig colours

Diffstat:
Mconfig.h | 14+++++++-------
Mslock.c | 6++++--
2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/config.h b/config.h @@ -3,22 +3,22 @@ static const char *user = "nobody"; static const char *group = "nogroup"; static const char *colorname[NUMCOLS] = { - [INIT]="#0c0a14", /* after initialization */ - [INPUT]="#141726", /* during input */ - [FAILED]="#892b2b", /* wrong password */ + [INIT] = "#050a10", /* after initialization */ + [INPUT] = "#080d13", /* during input */ + [FAILED] = "#90222b", /* wrong password */ }; /* treat a cleared input like a wrong password (color) */ static const int failonclear = 0; /* default message */ -static const char * message = "Locked"; +static const char *message = "Locked"; /* text color */ -static const char * text_color = "#1e5eb1"; +static const char *text_color = "#1e5eb1"; /* text size (must be a valid size) */ -static const char * font_name = "-b&h-lucidatypewriter-medium-r-normal-sans-0-0-75-75-m-0-iso8859-15"; +static const char *font_name = "-b&h-lucidatypewriter-medium-r-normal-sans-0-0-75-75-m-0-iso8859-15"; /* seconds before monitor shuts off */ -static const int monitortime = 50; +static const int monitortime = 15; diff --git a/slock.c b/slock.c @@ -263,7 +263,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, running = !!strcmp(inputhash, hash); if (running) { XBell(dpy, 100); - failure = 1; + color = FAILED; } explicit_bzero(&passwd, sizeof(passwd)); len = 0; @@ -275,6 +275,8 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, case XK_BackSpace: if (len) passwd[--len] = '\0'; + if (!len) + color = INIT; break; default: if (num && !iscntrl((int)buf[0]) && @@ -282,9 +284,9 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, memcpy(passwd + len, buf, num); len += num; } + color = INPUT; break; } - color = len ? INPUT : ((failure || failonclear) ? FAILED : INIT); if (running && oldc != color) { for (screen = 0; screen < nscreens; screen++) { XSetWindowBackground(dpy,