From b3eaa85cc9c4cfd4a50768dca3800553c0184f01 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 11 Feb 2010 13:05:12 +0000 Subject: [PATCH] default to an icon based terminal bell indication, and add such an icon from Tango. --- data/icons/16x16/status/terminal-bell.png | Bin 0 -> 863 bytes setup.py | 2 ++ terminatorlib/config.py | 3 ++- terminatorlib/terminal.py | 10 +++++++--- terminatorlib/titlebar.py | 15 +++++++++++++++ 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 data/icons/16x16/status/terminal-bell.png diff --git a/data/icons/16x16/status/terminal-bell.png b/data/icons/16x16/status/terminal-bell.png new file mode 100644 index 0000000000000000000000000000000000000000..8851b99ba1060109ab8387fd9254870480e9284c GIT binary patch literal 863 zcmV-l1EBngP)Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00OH?L_t(I%axK#NK|nY#=rmEJLA1N*GDEB)OrZasDZh+oSvYeh-b)!X&wkCqi5%=xUSx|_F{6#zu1AgWFc?@DNvi{=o` zb31h=C3AB8Z6^Sj!X$=0S8gvrAf%45EJH13#vp`HP#BtSD3rqJ8l3DdD$D`Ha;MgE zVZf?F;{_`ZSZ+ivaM`C+Z(3 zy#C(dnS~`$HdpLVs~B>P!OCIcuN!O=LdQG1`sJDF`RueL>!EAy12@kc&bs9OG9O}C zlIXN&Rr?p0a@>O>s=)e6!>h0VgJY)~t7IxXFDosw6duS%G|xfRb@-M=47tYf&NZUN zanj`{?Kd7o1OPy7T|;7sZgB-3|fr;X0czA^&R5dAdz!r1Ht08mwZ p@_LOR#2;B$Sa_Y67yBrZ={HtPHeP&+9RvUX002ovPDHLkV1i2wZan}1 literal 0 HcmV?d00001 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)