[dev] [st][PATCH] Add audible bell

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Thu, 12 Sep 2013 20:41:34 +0200

From: "Roberto E. Vargas Caballero" <rvargas_AT_bsccs347.bsc.es>

\a is the character for bell, and st is only marking the window as urgent
if it is not active. This patch adds an audible bell which can be disable
with bellvolume variable.
---
 config.def.h | 6 ++++++
 st.c         | 2 ++
 2 files changed, 8 insertions(+)
diff --git a/config.def.h b/config.def.h
index 24aeb19..6487406 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -37,6 +37,12 @@ static unsigned int actionfps = 30;
  */
 static unsigned int blinktimeout = 800;
 
+/*
+ * bell volume. It must be a value between -100 and 100. Use 0 for disabling
+ * it
+ */
+static int bellvolume = 1;
+
 /* TERM value */
 static char termname[] = "st-256color";
 
diff --git a/st.c b/st.c
index 96d45bf..4a91073 100644
--- a/st.c
+++ b/st.c
_AT_@ -2320,6 +2320,8 @@ tputc(char *c, int len) {
 		case '\a':   /* BEL */
 			if(!(xw.state & WIN_FOCUSED))
 				xseturgency(1);
+			if (bellvolume)
+				XBell(xw.dpy, bellvolume);
 			return;
 		case '\033': /* ESC */
 			csireset();
-- 
1.8.3.4
Received on Thu Sep 12 2013 - 20:41:34 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 12 2013 - 20:48:06 CEST