[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#855856: x11-apps: patch to limit how often xbiff will beep



Package: x11-apps
Version: 7.7+6
Severity: wishlist
Tags: patch

I often get a number of logcheck emails during the first 5 minutes of
the hour from different systems, which have different propagation
times. This leads to xbiff beeping at me every 30s (the default polling
time), which I find a bit excessive.

I had whipped up a patch to make the minimum interval configurable via
an X resource, e.g. in my ~/.Xdefaults file I have the line:

xbiff*beepInterval: 300

which sets the time to 300 seconds.

I had been using this locally.  After I recently upgraded to stretch I
noticed that xbiff was beeping too much again, and then remembered the
patch I had made, which was now replaced by a newer version. So I do
miss the patch :)

I've attached the patch.
Since making it (some time ago) I've been wondering whether changing the
pool interval should be the better way of doing it. However, the way
I've done it has been tested extensively :)

Thanks,
Paul

-- System Information:
Debian Release: 9.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.9-wurtel-ws (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)

Versions of packages x11-apps depends on:
ii  libc6        2.24-9
ii  libpng16-16  1.6.28-1
ii  libsm6       2:1.2.2-1+b1
ii  libx11-6     2:1.6.4-3
ii  libxaw7      2:1.0.13-1
ii  libxcursor1  1:1.1.14-1+b1
ii  libxext6     2:1.3.3-1
ii  libxft2      2.3.2-1
ii  libxkbfile1  1:1.0.9-2
ii  libxmu6      2:1.1.2-2
ii  libxmuu1     2:1.1.2-2
ii  libxrender1  1:0.9.10-1
ii  libxt6       1:1.1.5-1
ii  man-db       2.7.6.1-2

Versions of packages x11-apps recommends:
ii  xbitmaps  1.1.1-2

Versions of packages x11-apps suggests:
ii  mesa-utils  8.3.0-3

-- no debconf information
--- x11-apps-7.7+4/xbiff/Mailbox.c	2013-07-09 17:03:32.000000000 +0200
+++ x11-apps-7.7+4-mod?/xbiff/Mailbox.c	2015-02-28 12:53:27.223187344 +0100
@@ -53,6 +53,7 @@
 #include <sys/stat.h>			/* for stat() ** needs types.h ***/
 #include <stdio.h>			/* for printing error messages */
 #include <unistd.h>
+#include <time.h>
 
 #ifndef X_NOT_POSIX
 #ifdef _POSIX_SOURCE
@@ -142,6 +143,8 @@
 	offset (volume), XtRString, "33"},
     { XtNonceOnly, XtCBoolean, XtRBoolean, sizeof(Boolean),
 	offset (once_only), XtRImmediate, (XtPointer)False },
+    { XtNbeepInterval, XtCInterval, XtRInt, sizeof (int),
+	offset (beep_interval), XtRString, "30" },
     { XtNfullPixmap, XtCPixmap, XtRBitmap, sizeof(Pixmap),
 	offset (full.bitmap), XtRString, "flagup" },
     { XtNfullPixmapMask, XtCPixmapMask, XtRBitmap, sizeof(Pixmap),
@@ -435,6 +438,7 @@
 {
     long mailboxsize = 0;
     Boolean readSinceLastWrite = FALSE;
+    static time_t lastbeep = 0;
 
     if (w->mailbox.check_command != NULL) {
 	waitType wait_status;
@@ -501,8 +505,10 @@
 	    force_redraw = TRUE;
 	}
     } else if (mailboxsize != w->mailbox.last_size) {  /* different size */
-	if (!w->mailbox.once_only || !w->mailbox.flag_up)
+	if ((!w->mailbox.once_only || !w->mailbox.flag_up) && lastbeep + w->mailbox.beep_interval < time(NULL)) {
 	    beep(w); 
+	    lastbeep = time(NULL);
+	}
 	if (!w->mailbox.flag_up)
 	    force_redraw = w->mailbox.flag_up = TRUE;
     } 

Reply to: