summaryrefslogtreecommitdiff
path: root/slock/patches/slock-noxbell-0.2.diff
blob: 5a189e4d9ad96cc501c32025e41ed05f5ffc66ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From f8bd65f192bc09fddcbc3d5a61f4dd2bba283adf Mon Sep 17 00:00:00 2001
From: John Doe <bankai671@proton.me>
Date: Mon, 19 Feb 2024 22:01:05 +0100
Subject: [PATCH] add bell sound configuration

---
 config.h | 3 +++
 slock.c  | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h
index 9855e21..b32a2cf 100644
--- a/config.def.h
+++ b/config.def.h
@@ -10,3 +10,6 @@ static const char *colorname[NUMCOLS] = {

 /* treat a cleared input like a wrong password (color) */
 static const int failonclear = 1;
+
+/* enable or disable (1 means enable, 0 disable) bell sound when password is incorrect */
+static const int xbell = 0;
diff --git a/slock.c b/slock.c
index 5ae738c..f40ea23 100644
--- a/slock.c
+++ b/slock.c
@@ -165,7 +165,8 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
 				else
 					running = !!strcmp(inputhash, hash);
 				if (running) {
-					XBell(dpy, 100);
+					if (xbell == 1)
+						XBell(dpy, 100);
 					failure = 1;
 				}
 				explicit_bzero(&passwd, sizeof(passwd));
--
2.43.0