diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index b543e215..f59d8eb8 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -35,10 +35,18 @@ Default value: \fBFalse\fR .TP \fBNOTE:\fR To enable transparency you should also see the \fBbackground_type\fR and \fBbackground_darkness\fR settings below. .TP -.B silent_bell\fR (boolean) -If true, don't make a noise when applications send the escape sequence for the terminal bell. Flash the terminal instead. +.B audible_bell\fR (boolean) +If true, make a noise when applications send the escape sequence for the terminal bell. Default value: \fBTrue\fR .TP +.B visible_bell\fR (boolean) +If true, flash the terminal when applications send the escape sequence for the terminal bell. +Default value: \fBFalse\fR +.TP +.B urgent_bell\fR (boolean) +If true, set the window manager "urgent" hint when applications send the escale sequence for the terminal bell. Any keypress will cancel the urgent status. +Default value: \fBFalse\fR +.TP .B force_no_bell\fR (boolean) If true, don't make a noise or flash. All terminal bells will be ignored. Default value: \fBFalse\fR diff --git a/terminatorlib/config.py b/terminatorlib/config.py index d0d12e2d..df82d859 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -61,7 +61,9 @@ Defaults = { 'titlebars' : True, 'titletips' : False, 'allow_bold' : True, - 'silent_bell' : True, + 'audible_bell' : False, + 'visible_bell' : True, + 'urgent_bell' : False, 'background_color' : '#000000', 'background_darkness' : 0.5, 'background_type' : 'solid', @@ -309,6 +311,15 @@ Errors were encountered while parsing terminator_config(5) file: if len(sections) > 0: section = sections[0] if section is None: + # handle some deprecated configs + if key == 'silent_bell': + err ("silent_bell config option is deprecated, for the new bell related config options, see: man terminator_config") + if value: + self.values['audible_bell'] = False + else: + self.values['audible_bell'] = True + key = 'visible_bell' + if not Defaults.has_key (key): raise ValueError("Unknown configuration option %r" % key) deftype = Defaults[key].__class__.__name__ diff --git a/terminatorlib/prefs_profile.py b/terminatorlib/prefs_profile.py index 0849b584..fe26e30a 100644 --- a/terminatorlib/prefs_profile.py +++ b/terminatorlib/prefs_profile.py @@ -8,7 +8,7 @@ import gtk, gobject class ProfileEditor: # lists of which settings to put in which tabs - appearance = ['titlebars', 'titletips', 'allow_bold', 'silent_bell', 'force_no_bell', 'background_darkness', 'background_type', 'background_image', 'cursor_blink', 'font', 'scrollbar_position', 'scroll_background', 'use_system_font', 'use_theme_colors', 'enable_real_transparency'] + appearance = ['titlebars', 'titletips', 'allow_bold', 'audible_bell', 'visible_bell', 'urgent_bell', 'force_no_bell', 'background_darkness', 'background_type', 'background_image', 'cursor_blink', 'font', 'scrollbar_position', 'scroll_background', 'use_system_font', 'use_theme_colors', 'enable_real_transparency'] colours = ['foreground_color','background_color', 'palette'] behaviour = ['backspace_binding', 'delete_binding', 'emulation', 'scroll_on_keystroke', 'scroll_on_output', 'scrollback_lines', 'focus', 'focus_on_close', 'exit_action', 'word_chars', 'mouse_autohide', 'use_custom_command', 'custom_command', 'http_proxy', 'encoding'] globals = ['fullscreen', 'maximise', 'borderless', 'handle_size', 'cycle_term_tab', 'close_button_on_tab', 'tab_position', 'copy_on_selection', 'extreme_tabs', 'try_posix_regexp'] diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 0f5dd5af..4e493ed2 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -128,6 +128,7 @@ class TerminatorNotebookTabLabel(gtk.HBox): class Terminator: options = None groupings = None + _urgency = False def __init__ (self, profile = None, command = None, fullscreen = False, maximise = False, borderless = False, no_gconf = False, @@ -452,6 +453,16 @@ class Terminator: def on_destroy_event (self, widget, data=None): self.die() + def on_beep (self, terminal): + self.set_urgency (True) + + def set_urgency (self, on): + if on == self._urgency: + return + + self._urgency = on + self.window.set_urgency_hint (on) + # keybindings for the whole terminal window (affects the main # windows containing the splited terminals) def on_key_press (self, window, event): @@ -460,6 +471,7 @@ class Terminator: * F11: toggle fullscreen state of the window. * CTRL - SHIFT - Q: close all terminals """ + self.set_urgency (False) mapping = self.keybindings.lookup(event) if mapping: diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 52b6490c..a5973625 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -141,6 +141,7 @@ class TerminatorTerm (gtk.VBox): _custom_font_size = None _group = None focus = None + _urgent_bell_cnid = None def __init__ (self, terminator, profile = None, command = None, cwd = None): gtk.VBox.__init__ (self) @@ -714,17 +715,25 @@ text/plain # Set our cursor blinkiness self._vte.set_cursor_blinks (self.conf.cursor_blink) - # Set our audible belliness - silent_bell = self.conf.silent_bell - self._vte.set_audible_bell (not silent_bell) - - # Set our visual flashiness - self._vte.set_visible_bell (silent_bell) - - # Override our flashybelliness if self.conf.force_no_bell: - self._vte.set_visible_bell (False) self._vte.set_audible_bell (False) + self._vte.set_visible_bell (False) + if self._urgent_bell_cnid: + self._vte.disconnect (self._urgent_bell_cnid) + self._urgent_bell_cnid = None + else: + # Set our audible belliness + self._vte.set_audible_bell (self.conf.audible_bell) + + # Set our visual flashiness + self._vte.set_visible_bell (self.conf.visible_bell) + + # Set our urgent belliness + if self.conf.urgent_bell: + self._urgent_bell_cnid = self._vte.connect ("beep", self.terminator.on_beep) + elif self._urgent_bell_cnid: + self._vte.disconnect (self._urgent_bell_cnid) + self._urgent_bell_cnid = None # Set our scrolliness self._vte.set_scrollback_lines (self.conf.scrollback_lines)