From e2db10fc09f0ae1edada5b7f5369d06ad0ccb206 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 21 Jan 2010 00:13:56 +0000 Subject: [PATCH] Implement urgent bell handler --- terminatorlib/terminal.py | 14 ++++++++++---- terminatorlib/window.py | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index fc417705..df9c4c4b 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -566,11 +566,12 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) else: self.vte.set_audible_bell(self.config['audible_bell']) self.vte.set_visible_bell(self.config['visible_bell']) + self.cnxids.remove_signal(self.vte, 'urgent_bell') if self.config['urgent_bell'] == True: - # FIXME: Hook up a signal handler here - pass - else: - self.cnxids.remove_signal(self.vte, 'urgent_bell') + try: + self.cnxids.new(self.vte, 'beep', self.on_beep) + except TypeError: + err('beep signal unavailable with this version of VTE') self.vte.set_scrollback_lines(self.config['scrollback_lines']) self.vte.set_scroll_on_keystroke(self.config['scroll_on_keystroke']) @@ -1097,6 +1098,11 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) """Return the column/rows of the terminal""" return((self.vte.get_column_count(), self.vte.get_row_count())) + def on_beep(self, widget): + """Set the urgency hint for our window""" + window = util.get_top_window(self) + window.set_urgency_hint(True) + # There now begins a great list of keyboard event handlers # FIXME: Probably a bunch of these are wrong. TEST! def key_zoom_in(self): diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 40a76f84..aa296e1c 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -132,7 +132,8 @@ class Window(Container, gtk.Window): def on_key_press(self, window, event): """Handle a keyboard event""" maker = Factory() - # FIXME: We probably want to cancel window urgency here + + self.set_urgency_hint(False) mapping = self.terminator.keybindings.lookup(event)