mirror of
https://github.com/mintycube/slock.git
synced 2024-10-22 14:05:51 +02:00
Adding failure-command patch
This commit is contained in:
parent
d7b259be34
commit
7dc450118f
@ -26,6 +26,8 @@ slock tool, how to install it and how it works.
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
2021-09-09 - Added the failure-command patch
|
||||||
|
|
||||||
2021-06-08 - Added the color message patch
|
2021-06-08 - Added the color message patch
|
||||||
|
|
||||||
2020-08-03 - Added alpha, keypress_feedback and blur_pixelated_screen patches
|
2020-08-03 - Added alpha, keypress_feedback and blur_pixelated_screen patches
|
||||||
@ -64,6 +66,9 @@ slock tool, how to install it and how it works.
|
|||||||
- the monitor will automatically be activated by pressing a key or moving the mouse and the
|
- the monitor will automatically be activated by pressing a key or moving the mouse and the
|
||||||
password can be entered then
|
password can be entered then
|
||||||
|
|
||||||
|
- [failure-command](https://tools.suckless.org/slock/patches/failure-command/)
|
||||||
|
- allows for a command to be run after a specified number of incorrect attempts
|
||||||
|
|
||||||
- [keypress_feedback](https://tools.suckless.org/slock/patches/keypress-feedback/)
|
- [keypress_feedback](https://tools.suckless.org/slock/patches/keypress-feedback/)
|
||||||
- draws random blocks on the screen to display keypress feedback
|
- draws random blocks on the screen to display keypress feedback
|
||||||
|
|
||||||
|
@ -56,6 +56,15 @@ static const float alpha = 0.9;
|
|||||||
/* treat a cleared input like a wrong password (color) */
|
/* treat a cleared input like a wrong password (color) */
|
||||||
static const int failonclear = 1;
|
static const int failonclear = 1;
|
||||||
|
|
||||||
|
#if FAILURE_COMMAND_PATCH
|
||||||
|
/* number of failed password attempts until failcommand is executed.
|
||||||
|
Set to 0 to disable */
|
||||||
|
static const int failcount = 0;
|
||||||
|
|
||||||
|
/* command to be executed after [failcount] failed password attempts */
|
||||||
|
static const char *failcommand = "shutdown";
|
||||||
|
#endif // FAILURE_COMMAND_PATCH
|
||||||
|
|
||||||
#if BLUR_PIXELATED_SCREEN_PATCH
|
#if BLUR_PIXELATED_SCREEN_PATCH
|
||||||
/* Enable blur */
|
/* Enable blur */
|
||||||
#define BLUR
|
#define BLUR
|
||||||
|
@ -60,6 +60,11 @@
|
|||||||
*/
|
*/
|
||||||
#define DPMS_PATCH 0
|
#define DPMS_PATCH 0
|
||||||
|
|
||||||
|
/* This patch allows for a command to be run after a specified number of incorrect attempts.
|
||||||
|
* https://tools.suckless.org/slock/patches/failure-command/
|
||||||
|
*/
|
||||||
|
#define FAILURE_COMMAND_PATCH 0
|
||||||
|
|
||||||
/* Draws random blocks on the screen to display keypress feedback.
|
/* Draws random blocks on the screen to display keypress feedback.
|
||||||
* https://tools.suckless.org/slock/patches/keypress-feedback/
|
* https://tools.suckless.org/slock/patches/keypress-feedback/
|
||||||
* https://patch-diff.githubusercontent.com/raw/phenax/bslock/pull/2.diff
|
* https://patch-diff.githubusercontent.com/raw/phenax/bslock/pull/2.diff
|
||||||
|
10
slock.c
10
slock.c
@ -43,6 +43,9 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
char *argv0;
|
char *argv0;
|
||||||
|
#if FAILURE_COMMAND_PATCH
|
||||||
|
int failtrack = 0;
|
||||||
|
#endif // FAILURE_COMMAND_PATCH
|
||||||
|
|
||||||
#if QUICKCANCEL_PATCH
|
#if QUICKCANCEL_PATCH
|
||||||
static time_t locktime;
|
static time_t locktime;
|
||||||
@ -272,6 +275,13 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
|
|||||||
if (running) {
|
if (running) {
|
||||||
XBell(dpy, 100);
|
XBell(dpy, 100);
|
||||||
failure = 1;
|
failure = 1;
|
||||||
|
#if FAILURE_COMMAND_PATCH
|
||||||
|
failtrack++;
|
||||||
|
|
||||||
|
if (failtrack >= failcount && failcount != 0) {
|
||||||
|
system(failcommand);
|
||||||
|
}
|
||||||
|
#endif // FAILURE_COMMAND_PATCH
|
||||||
}
|
}
|
||||||
explicit_bzero(&passwd, sizeof(passwd));
|
explicit_bzero(&passwd, sizeof(passwd));
|
||||||
len = 0;
|
len = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user