aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidpkj <davidpenkow1@gmail.com>2022-05-28 22:02:45 +0200
committerdavidpkj <davidpenkow1@gmail.com>2023-08-27 20:54:02 +0200
commit8c5a66db15f76c0fe156d4b2fc7c00f636092f20 (patch)
tree87d77b069fc297254e682777d5a4a2809c8e4cf8
parentc81ee6f0ab8b33b4bf4a155d4b627fe2d36d87ff (diff)
slock dwm logo
-rw-r--r--config.h5
-rw-r--r--slock.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/config.h b/config.h
index 7b3aaf3..81c909d 100644
--- a/config.h
+++ b/config.h
@@ -11,6 +11,9 @@ static const char *colorname[NUMCOLS] = {
/* treat a cleared input like a wrong password (color) */
static const int failonclear = 1;
+/* time in seconds to cancel lock with mouse movement */
+static const int timetocancel = 3;
+
/* insert grid pattern with scale 1:1, the size can be changed with logosize */
static const int logosize = 75;
/* grid width and height for right center alignment */
@@ -33,7 +36,7 @@ static XRectangle rectangles[9] = {
/*Enable blur*/
#define BLUR
/*Set blur radius*/
-static const int blurRadius=9;
+static const int blurRadius=5;
/*Enable Pixelation*/
//#define PIXELATION
/*Set pixelation radius*/
diff --git a/slock.c b/slock.c
index efbe833..23f89e6 100644
--- a/slock.c
+++ b/slock.c
@@ -14,6 +14,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <time.h>
#include <sys/types.h>
#include <X11/extensions/Xrandr.h>
#ifdef XINERAMA
@@ -30,6 +31,8 @@
char *argv0;
+static time_t locktime;
+
enum {
INIT,
INPUT,
@@ -183,6 +186,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
oldc = INIT;
while (running && !XNextEvent(dpy, &ev)) {
+ running = !((time(NULL) - locktime < timetocancel) && (ev.type == MotionNotify));
if (ev.type == KeyPress) {
explicit_bzero(&buf, sizeof(buf));
num = XLookupString(&ev.xkey, buf, sizeof(buf), &ksym, 0);
@@ -353,6 +357,7 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
XSelectInput(dpy, lock->root, SubstructureNotifyMask);
drawlogo(dpy, lock, INIT);
+ locktime = time(NULL);
return lock;
}