Make the bell options more explicit and allow multiple bell actions, including a new one to set the window manager urgent hint. Closes LP: #272749

This commit is contained in:
Chris Jones 2009-03-20 10:13:29 +00:00
parent d54f21c203
commit de62f1bda4
5 changed files with 53 additions and 13 deletions

View File

@ -35,10 +35,18 @@ Default value: \fBFalse\fR
.TP .TP
\fBNOTE:\fR To enable transparency you should also see the \fBbackground_type\fR and \fBbackground_darkness\fR settings below. \fBNOTE:\fR To enable transparency you should also see the \fBbackground_type\fR and \fBbackground_darkness\fR settings below.
.TP .TP
.B silent_bell\fR (boolean) .B audible_bell\fR (boolean)
If true, don't make a noise when applications send the escape sequence for the terminal bell. Flash the terminal instead. If true, make a noise when applications send the escape sequence for the terminal bell.
Default value: \fBTrue\fR Default value: \fBTrue\fR
.TP .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) .B force_no_bell\fR (boolean)
If true, don't make a noise or flash. All terminal bells will be ignored. If true, don't make a noise or flash. All terminal bells will be ignored.
Default value: \fBFalse\fR Default value: \fBFalse\fR

View File

@ -61,7 +61,9 @@ Defaults = {
'titlebars' : True, 'titlebars' : True,
'titletips' : False, 'titletips' : False,
'allow_bold' : True, 'allow_bold' : True,
'silent_bell' : True, 'audible_bell' : False,
'visible_bell' : True,
'urgent_bell' : False,
'background_color' : '#000000', 'background_color' : '#000000',
'background_darkness' : 0.5, 'background_darkness' : 0.5,
'background_type' : 'solid', 'background_type' : 'solid',
@ -309,6 +311,15 @@ Errors were encountered while parsing terminator_config(5) file:
if len(sections) > 0: if len(sections) > 0:
section = sections[0] section = sections[0]
if section is None: 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): if not Defaults.has_key (key):
raise ValueError("Unknown configuration option %r" % key) raise ValueError("Unknown configuration option %r" % key)
deftype = Defaults[key].__class__.__name__ deftype = Defaults[key].__class__.__name__

View File

@ -8,7 +8,7 @@ import gtk, gobject
class ProfileEditor: class ProfileEditor:
# lists of which settings to put in which tabs # 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'] 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'] 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'] globals = ['fullscreen', 'maximise', 'borderless', 'handle_size', 'cycle_term_tab', 'close_button_on_tab', 'tab_position', 'copy_on_selection', 'extreme_tabs', 'try_posix_regexp']

View File

@ -128,6 +128,7 @@ class TerminatorNotebookTabLabel(gtk.HBox):
class Terminator: class Terminator:
options = None options = None
groupings = None groupings = None
_urgency = False
def __init__ (self, profile = None, command = None, fullscreen = False, def __init__ (self, profile = None, command = None, fullscreen = False,
maximise = False, borderless = False, no_gconf = False, maximise = False, borderless = False, no_gconf = False,
@ -452,6 +453,16 @@ class Terminator:
def on_destroy_event (self, widget, data=None): def on_destroy_event (self, widget, data=None):
self.die() 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 # keybindings for the whole terminal window (affects the main
# windows containing the splited terminals) # windows containing the splited terminals)
def on_key_press (self, window, event): def on_key_press (self, window, event):
@ -460,6 +471,7 @@ class Terminator:
* F11: toggle fullscreen state of the window. * F11: toggle fullscreen state of the window.
* CTRL - SHIFT - Q: close all terminals * CTRL - SHIFT - Q: close all terminals
""" """
self.set_urgency (False)
mapping = self.keybindings.lookup(event) mapping = self.keybindings.lookup(event)
if mapping: if mapping:

View File

@ -141,6 +141,7 @@ class TerminatorTerm (gtk.VBox):
_custom_font_size = None _custom_font_size = None
_group = None _group = None
focus = None focus = None
_urgent_bell_cnid = None
def __init__ (self, terminator, profile = None, command = None, cwd = None): def __init__ (self, terminator, profile = None, command = None, cwd = None):
gtk.VBox.__init__ (self) gtk.VBox.__init__ (self)
@ -714,17 +715,25 @@ text/plain
# Set our cursor blinkiness # Set our cursor blinkiness
self._vte.set_cursor_blinks (self.conf.cursor_blink) self._vte.set_cursor_blinks (self.conf.cursor_blink)
if self.conf.force_no_bell:
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 # Set our audible belliness
silent_bell = self.conf.silent_bell self._vte.set_audible_bell (self.conf.audible_bell)
self._vte.set_audible_bell (not silent_bell)
# Set our visual flashiness # Set our visual flashiness
self._vte.set_visible_bell (silent_bell) self._vte.set_visible_bell (self.conf.visible_bell)
# Override our flashybelliness # Set our urgent belliness
if self.conf.force_no_bell: if self.conf.urgent_bell:
self._vte.set_visible_bell (False) self._urgent_bell_cnid = self._vte.connect ("beep", self.terminator.on_beep)
self._vte.set_audible_bell (False) elif self._urgent_bell_cnid:
self._vte.disconnect (self._urgent_bell_cnid)
self._urgent_bell_cnid = None
# Set our scrolliness # Set our scrolliness
self._vte.set_scrollback_lines (self.conf.scrollback_lines) self._vte.set_scrollback_lines (self.conf.scrollback_lines)