GNOME Bugzilla – Bug 329108
Please support setting X's URGENCY hint upon terminal beep
Last modified: 2008-12-24 17:50:31 UTC
Hi, Jeroen van Wolffelaar provided in Debian bug http://bugs.debian.org/276575 a preliminary patch to support X' URGENCY hint in vte. Quoting Jeroen: "When one has opened a lot of terminals, it can be tricky to find the one terminal that made your system beep, or maybe you were away while that happened. Therefore, it'd be nice if gnome-terminal could set the urgency hint on the X window, so that the window manager in use can alert the user. This is particularly interesting using ion2 windowmanager, but others also support this hint. This patch will enable this feature, it works to my satisfaction, but it has the following caveats: - it doesn't clear the urgency hint, I don't know how it gets cleared (window manager? gnome-terminal itself upon focus?), but anyway, it gets somehow cleared when it has focus (and seems to not get set if having focus) - it is always-enabled. The code is easily moved to be enabled with either the visible-bell or audible-bell options - It will segfault if widget->window doesn't exist, or has no TopLevel GdkWindow, or that TopLevel GdkWindow doesn't have hints (TTBOMK, this should never-happen[tm]) Of course, feel free to drop the BEGIN/END added comments, I used that for my own convenience locally managing this unofficial patch. I submit this code under whatever licence this library is under, as long as it remains Debian Free Software Guidelines-Free." I tested the patch, and it will make the icon of a gnome-terminal window blink in the task list as soon as a terminal bell rings, however metacity doesn't reset the hint as Jeroen experienced (presumably he runs a different WM). I'll attach his patch updated to apply to 0.11.17. Cheers,
Created attachment 58337 [details] [review] Add support for X' URGENCY hint upon terminal bell
Of course this needs work if the thing never stops blinking under our official window manager.
Oh, also setting to NEW, this is a nice thing to have.
Guilherme, you think it should stop blinking after a while?
(Setting to NEW again as I think NEEDINFO is more when people are waiting for the submitter.)
Created attachment 80520 [details] [review] Set the urgent hint on terminal bell. Uses the Gtk+ interface rather than raw X WM hints, and remembers to disable it after a second.
After a second? I think it should stop after 1) you switch to its window, or 2) you type something. The entire idea is to retain the fact that it beeped. If it stops after one second, it's just a fancier beep.
Shouldn't the widget emit a "beep" signal, so that apps interested in the urgency hint can set it themselves? This patch is not notifying the app, and an app may have several vte widgets (gnome-terminal...) and may want to do something smarter than simply get its toplevel flashed (someday, GNOME may decide on a standard way to do activity signaling in tabbed interfaces and elsewhere). Or it may have several things in its UI that can be in need of urgent attention and then it may be of use to know exactly -which- widget is feeling the urge to get attention... &c. I'm not a great fan of widgets that do things on their toplevel, I guess.
True. g-t should highlight the tab for example.
Created attachment 80590 [details] [review] Simply emit a beep signal on terminal beep.
Thanks. From looking at the patch: * The signal is created with the name "bell" but your call to g_signal_emit_by_name uses "beep". * The patch has an extraneous bell_signal member added to VteTerminalClass. * Avoid adding whitespace lines ;-) The source looks funny as it is ;-) I have not tested the patch (from the 1st bullet above it cannot work, really) but looks essentially correct.
Created attachment 80642 [details] [review] Emit a beep The signal name should be a verb so beep is preferred over bell.
*** Bug 420708 has been marked as a duplicate of this bug. ***
The patch looks good and ready to commit IMHO, would only be nice to have it's counterpart patch for gnome-terminal :)
Need to branch&bump, but looks good to go.
Created attachment 113316 [details] [review] updated version of the patch The current patch doesn't apply to trunk. This version should.
Created attachment 113317 [details] [review] updated version of the patch Sorry, that used g_signal_emit which didn't work. This one uses g_signal_emit_by_name as the original patch did.
Created attachment 116122 [details] [review] how I did it on XFCE Terminal This is what was required for XFCE's Terminal. The signals and the general method should be the same for GNOME Terminal.
That patch is broken: the focus-in-event handler needs to return a gboolean, not void. For g-t, I'd probably just use whether the beeping tab is the active tab or not.
Created attachment 116152 [details] [review] how I did it on XFCE Terminal - corrected version Thanks Christian. That explains why I had to explicitly refresh the VTE widget. Explicitly returning FALSE should cause the event to bubble thru to VTE as well.
*** Bug 167783 has been marked as a duplicate of this bug. ***
*** Bug 553778 has been marked as a duplicate of this bug. ***
Fixed on trunk.
IMHO we should rename the signal from "beep" to "bell".
*** Bug 558527 has been marked as a duplicate of this bug. ***
I don't have a strong preference, other than that I've already got GNOME Terminal and XFCE Terminal working with it called "beep". I kept the name "beep" in my respin of the patch based on Chris Wilson's comment in January 2007 (comment 13): The signal name should be a verb so beep is preferred over bell.