summaryrefslogtreecommitdiff
path: root/slock.c
diff options
context:
space:
mode:
authorNick Currier <nick.currier@gmail.com>2015-05-06 10:18:50 -0600
committerMarkus Teich <markus.teich@stusta.mhn.de>2015-05-08 16:44:06 +0200
commitb1289f30b79c9c5ea43a9e9c624406d7d0661692 (patch)
treefb675681cac4c4882e9f9da8c882ec0aeb7ec110 /slock.c
parentf5ef1b8eb5555da11e81d92d8d05acd4aba1ef40 (diff)
Option to not show failure color on clear
Diffstat (limited to 'slock.c')
-rw-r--r--slock.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/slock.c b/slock.c
index 6502c86..1551a9e 100644
--- a/slock.c
+++ b/slock.c
@@ -26,7 +26,7 @@
enum {
INIT,
INPUT,
- EMPTY,
+ FAILED,
NUMCOLS
};
@@ -42,6 +42,7 @@ typedef struct {
static Lock **locks;
static int nscreens;
static Bool running = True;
+static Bool failure = False;
static Bool rr;
static int rrevbase;
static int rrerrbase;
@@ -153,8 +154,10 @@ readpw(Display *dpy, const char *pws)
#else
running = !!strcmp(crypt(passwd, pws), pws);
#endif
- if (running)
+ if (running) {
XBell(dpy, 100);
+ failure = True;
+ }
len = 0;
break;
case XK_Escape:
@@ -178,7 +181,7 @@ readpw(Display *dpy, const char *pws)
}
} else if (llen != 0 && len == 0) {
for (screen = 0; screen < nscreens; screen++) {
- XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[EMPTY]);
+ XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[failure || failonclear ? FAILED : INIT]);
XClearWindow(dpy, locks[screen]->win);
}
}