diff --git a/data/icons/16x16/status/terminal-bell.png b/data/icons/16x16/status/terminal-bell.png new file mode 100644 index 00000000..8851b99b Binary files /dev/null and b/data/icons/16x16/status/terminal-bell.png differ diff --git a/setup.py b/setup.py index 919cfb04..5c79112f 100755 --- a/setup.py +++ b/setup.py @@ -175,6 +175,8 @@ setup(name=APP_NAME.capitalize(), ('share/icons/hicolor/32x32/apps', glob.glob('data/icons/32x32/apps/*.png')), ('share/icons/hicolor/48x48/apps', glob.glob('data/icons/48x48/apps/*.png')), ('share/icons/hicolor/16x16/actions', glob.glob('data/icons/16x16/actions/*.png')), + ('share/icons/hicolor/16x16/status', + glob.glob('data/icons/16x16/status/*.png')), ], packages=['terminatorlib', 'terminatorlib.configobj', 'terminatorlib.plugins'], diff --git a/terminatorlib/config.py b/terminatorlib/config.py index a924b12a..1ba9fc64 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -151,8 +151,9 @@ DEFAULTS = { 'default': { 'allow_bold' : True, 'audible_bell' : False, - 'visible_bell' : True, + 'visible_bell' : False, 'urgent_bell' : False, + 'icon_bell' : True, 'background_color' : '#000000000000', 'background_darkness' : 0.5, 'background_type' : 'solid', diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 01cbd7e4..3e284c8e 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -632,7 +632,8 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) self.vte.set_audible_bell(self.config['audible_bell']) self.vte.set_visible_bell(self.config['visible_bell']) self.cnxids.remove_signal(self.vte, 'beep') - if self.config['urgent_bell'] == True: + if self.config['urgent_bell'] == True or \ + self.config['icon_bell'] == True: try: self.cnxids.new(self.vte, 'beep', self.on_beep) except TypeError: @@ -1181,8 +1182,11 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) def on_beep(self, widget): """Set the urgency hint for our window""" - window = util.get_top_window(self) - window.set_urgency_hint(True) + if self.config['urgent_bell'] == True: + window = util.get_top_window(self) + window.set_urgency_hint(True) + if self.config['icon_bell'] == True: + self.titlebar.icon_bell() def describe_layout(self, count, parent, global_layout): """Describe our layout""" diff --git a/terminatorlib/titlebar.py b/terminatorlib/titlebar.py index a0a43cb6..245c33fa 100755 --- a/terminatorlib/titlebar.py +++ b/terminatorlib/titlebar.py @@ -27,6 +27,7 @@ class Titlebar(gtk.EventBox): groupicon = None grouplabel = None groupentry = None + bellicon = None __gsignals__ = { 'clicked': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), @@ -50,6 +51,8 @@ class Titlebar(gtk.EventBox): grouphbox = gtk.HBox() self.grouplabel = gtk.Label() self.groupicon = gtk.Image() + self.bellicon = gtk.Image() + self.bellicon.set_no_show_all(True) self.groupentry = gtk.Entry() self.groupentry.set_no_show_all(True) @@ -74,10 +77,12 @@ class Titlebar(gtk.EventBox): self.ebox.add(grouphbox) self.ebox.show_all() + self.bellicon.set_from_icon_name('terminal-bell', gtk.ICON_SIZE_MENU) hbox = gtk.HBox() hbox.pack_start(self.ebox, False, True, 0) hbox.pack_start(gtk.VSeparator(), False, True, 0) hbox.pack_start(self.label, True, True) + hbox.pack_end(self.bellicon, False, False, 2) self.add(hbox) hbox.show_all() @@ -218,4 +223,14 @@ class Titlebar(gtk.EventBox): if key == 'Escape': self.groupentry_cancel(None, None) + def icon_bell(self): + """A bell signal requires we display our bell icon""" + self.bellicon.show() + gobject.timeout_add(1000, self.icon_bell_hide) + + def icon_bell_hide(self): + """Handle a timeout which means we now hide the bell icon""" + self.bellicon.hide() + return(False) + gobject.type_register(Titlebar)