]> git.armaanb.net Git - st.git/commitdiff
Add audible bell
authorRoberto E. Vargas Caballero <rvargas@bsccs347.bsc.es>
Thu, 12 Sep 2013 18:41:34 +0000 (20:41 +0200)
committerChristoph Lohmann <20h@r-36.net>
Thu, 12 Sep 2013 18:47:41 +0000 (20:47 +0200)
\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.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
config.def.h
st.c

index 24aeb1945d7728ebae23800b638fecaea8c69bf7..6487406eef3852431242d5c5fdbe53a4d9df39c4 100644 (file)
@@ -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 96d45bf4ae82f351489ec2814a5becaa0ba3afbc..4a91073c6a269fee660f3bfb999ec9fd9a287186 100644 (file)
--- a/st.c
+++ b/st.c
@@ -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();