sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit bb6ecc657825aba17de5f06aff411e15f0c8adb1
parent 00957dadd9ed4ecbd161d87b5434b8806d785a28
Author: Luna Hensey <hens25252@protonmail.com>
Date:   Sat, 28 Aug 2021 11:56:29 -0700

Failure Command

Diffstat:
Atools.suckless.org/slock/patches/failure-command/index.md | 14++++++++++++++
Atools.suckless.org/slock/patches/failure-command/slock-failure-command-1.4.diff | 39+++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/tools.suckless.org/slock/patches/failure-command/index.md b/tools.suckless.org/slock/patches/failure-command/index.md @@ -0,0 +1,14 @@ +Failure Command +=============== + +Description +----------- +This patch allows for a command to be run after a specified number of incorrect attempts + +Download +-------- +* [slock-failure-command.1.4.diff](slock-failure-command.1.4.diff) + +Author +------ +* Luna Hensley <lhdev25@gmail.com> diff --git a/tools.suckless.org/slock/patches/failure-command/slock-failure-command-1.4.diff b/tools.suckless.org/slock/patches/failure-command/slock-failure-command-1.4.diff @@ -0,0 +1,39 @@ +diff --git a/config.def.h b/config.def.h +index 9855e21..4c7b0d9 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -10,3 +10,10 @@ static const char *colorname[NUMCOLS] = { + + /* treat a cleared input like a wrong password (color) */ + static const int failonclear = 1; ++ ++/* 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"; +diff --git a/slock.c b/slock.c +index d2f0886..53c567f 100644 +--- a/slock.c ++++ b/slock.c +@@ -23,6 +23,7 @@ + #include "util.h" + + char *argv0; ++int failtrack = 0; + + enum { + INIT, +@@ -167,6 +168,11 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, + if (running) { + XBell(dpy, 100); + failure = 1; ++ failtrack++; ++ ++ if (failtrack >= failcount && failcount != 0){ ++ system(failcommand); ++ } + } + explicit_bzero(&passwd, sizeof(passwd)); + len = 0;