slock-noxbell-0.2.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       slock-noxbell-0.2.diff (1064B)
       ---
            1 From f8bd65f192bc09fddcbc3d5a61f4dd2bba283adf Mon Sep 17 00:00:00 2001
            2 From: John Doe <bankai671@proton.me>
            3 Date: Mon, 19 Feb 2024 22:01:05 +0100
            4 Subject: [PATCH] add bell sound configuration
            5 
            6 ---
            7  config.h | 3 +++
            8  slock.c  | 3 ++-
            9  2 files changed, 5 insertions(+), 1 deletion(-)
           10 
           11 diff --git a/config.h b/config.h
           12 index 9855e21..b32a2cf 100644
           13 --- a/config.h
           14 +++ b/config.h
           15 @@ -10,3 +10,6 @@ static const char *colorname[NUMCOLS] = {
           16  
           17  /* treat a cleared input like a wrong password (color) */
           18  static const int failonclear = 1;
           19 +
           20 +/* enable or disable (1 means enable, 0 disable) bell sound when password is incorrect */
           21 +static const int xbell = 0;
           22 diff --git a/slock.c b/slock.c
           23 index 5ae738c..f40ea23 100644
           24 --- a/slock.c
           25 +++ b/slock.c
           26 @@ -165,7 +165,8 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
           27                                  else
           28                                          running = !!strcmp(inputhash, hash);
           29                                  if (running) {
           30 -                                        XBell(dpy, 100);
           31 +                                        if (xbell == 1)
           32 +                                                XBell(dpy, 100);
           33                                          failure = 1;
           34                                  }
           35                                  explicit_bzero(&passwd, sizeof(passwd));
           36 -- 
           37 2.43.0
           38