M README.md => README.md +2 -0
@@ 26,6 26,8 @@ slock tool, how to install it and how it works.
### Changelog:
+2025-11-15 - Added the visual unlock patch
+
2022-03-28 - Added the background image patch
2021-09-13 - Added the dwm logo patch
M config.def.h => config.def.h +6 -1
@@ 137,7 137,12 @@ static const int controlkeyclear = 0;
#if DPMS_PATCH
/* time in seconds before the monitor shuts down */
-static const int monitortime = 5;
+static int monitortime = 5;
+
+#if VISUAL_UNLOCK_PATCH
+/* time in seconds before the monitor shuts down, if visual_unlock is enabled */
+static const int monitortime_vu = 0;
+#endif // VISUAL_UNLOCK_PATCH
#endif // DPMS_PATCH
#if KEYPRESS_FEEDBACK_PATCH
M patches.def.h => patches.def.h +7 -0
@@ 139,6 139,13 @@
*/
#define UNLOCKSCREEN_PATCH 0
+/* This patch adds a command line argument -u that keeps the input locked but do not
+ * show the lock screen. The original patch simply combines the unlock screen patch and
+ * the DPMS patch. Enable DPMS_PATCH separately if you want DPMS.
+ * https://tools.suckless.org/slock/patches/visual-unlock-dpms/
+ */
+#define VISUAL_UNLOCK_PATCH 0
+
/* This patch adds the ability to get colors via Xresources.
* https://tools.suckless.org/slock/patches/xresources/
*/
M slock.c => slock.c +19 -0
@@ 60,6 60,10 @@ int runflag = 0;
static time_t locktime;
#endif // QUICKCANCEL_PATCH
+#if VISUAL_UNLOCK_PATCH
+int visual_unlock = 0;
+#endif // VISUAL_UNLOCK_PATCH
+
enum {
#if DWM_LOGO_PATCH && !BLUR_PIXELATED_SCREEN_PATCH
BACKGROUND,
@@ 587,7 591,12 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
/* input is grabbed: we can lock the screen */
if (ptgrab == GrabSuccess && kbgrab == GrabSuccess) {
#if !UNLOCKSCREEN_PATCH
+ #if VISUAL_UNLOCK_PATCH
+ if (!visual_unlock)
+ XMapRaised(dpy, lock->win);
+ #else
XMapRaised(dpy, lock->win);
+ #endif // VISUAL_UNLOCK_PATCH
#endif // UNLOCKSCREEN_PATCH
if (rr->active)
XRRSelectInput(dpy, lock->win, RRScreenChangeNotifyMask);
@@ 670,6 679,11 @@ main(int argc, char **argv) {
}
return 0;
#endif // MESSAGE_PATCH | COLOR_MESSAGE_PATCH
+ #if VISUAL_UNLOCK_PATCH
+ case 'u':
+ visual_unlock = 1;
+ break;
+ #endif // VISUAL_UNLOCK_PATCH
default:
usage();
} ARGEND
@@ 749,6 763,11 @@ main(int argc, char **argv) {
#if DPMS_PATCH
/* DPMS magic to disable the monitor */
+ #if VISUAL_UNLOCK_PATCH
+ if (visual_unlock)
+ monitortime = monitortime_vu;
+ #endif // VISUAL_UNLOCK_PATCH
+
if (!DPMSCapable(dpy))
die("slock: DPMSCapable failed\n");
if (!DPMSEnable(dpy))