소스 검색

Add audible bell

\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>
Roberto E. Vargas Caballero 11 년 전
부모
커밋
bef599bb27
2개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      config.def.h
  2. 2 0
      st.c

+ 6 - 0
config.def.h

@@ -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";
 

+ 2 - 0
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();