diff --git a/terminatorlib/config.py b/terminatorlib/config.py index ae156329..0d239024 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -103,6 +103,7 @@ DEFAULTS = { 'custom_url_handler' : '', 'disable_real_transparency' : False, 'inactive_color_offset': 0.8, + 'inactive_bg_color_offset': 1.0, 'enabled_plugins' : ['LaunchpadBugURLHandler', 'LaunchpadCodeURLHandler', 'APTURLHandler'], diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index b8ca1749..8f9a33e2 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -394,6 +394,11 @@ 0.10 0.20 + + 1 + 0.10 + 0.20 + 1 2 @@ -941,7 +946,7 @@ 36 True - + True False @@ -960,7 +965,7 @@ 0 - 3 + 4 3 @@ -1014,7 +1019,7 @@ True baseline True - adjustment7 + adjustment8 2 2 False @@ -1084,7 +1089,7 @@ 0 - 5 + 6 @@ -1100,7 +1105,7 @@ 1 - 5 + 6 @@ -1118,7 +1123,7 @@ 2 - 5 + 6 @@ -1135,7 +1140,7 @@ 2 - 4 + 5 @@ -1151,7 +1156,7 @@ 1 - 4 + 5 @@ -1163,7 +1168,52 @@ 0 - 4 + 5 + + + + + True + False + Unfocused terminal background color: + 0 + + + 0 + 3 + + + + + True + False + 100% + right + 5 + 5 + 1 + + + 1 + 3 + + + + + 100 + True + True + True + adjustment7 + 2 + 2 + False + bottom + + + + 2 + 3 diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 2fc668d3..f805c8c6 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -674,6 +674,10 @@ class PrefsEditor: widget.set_value(float(self.config['inactive_color_offset'])) widget = guiget('inactive_color_offset_value_label') widget.set_text('%d%%' % (int(float(self.config['inactive_color_offset'])*100))) + widget = guiget('inactive_bg_color_offset') + widget.set_value(float(self.config['inactive_bg_color_offset'])) + widget = guiget('inactive_bg_color_offset_value_label') + widget.set_text('%d%%' % (int(float(self.config['inactive_bg_color_offset'])*100))) # Open links with a single click (instead of a Ctrl-left click) widget = guiget('link_single_click') widget.set_active(self.config['link_single_click']) @@ -1360,6 +1364,17 @@ class PrefsEditor: label_widget = guiget('inactive_color_offset_value_label') label_widget.set_text('%d%%' % (int(value * 100))) + def on_inactive_bg_color_offset_value_changed(self, widget): + """Inactive background color offset setting changed""" + value = widget.get_value() # This one is rounded according to the UI. + if value > 1.0: + value = 1.0 + self.config['inactive_bg_color_offset'] = value + self.config.save() + guiget = self.builder.get_object + label_widget = guiget('inactive_bg_color_offset_value_label') + label_widget.set_text('%d%%' % (int(value * 100))) + def on_handlesize_value_changed(self, widget): """Handle size changed""" value = widget.get_value() # This one is rounded according to the UI. diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 178d71a2..5add381b 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -112,6 +112,7 @@ class Terminal(Gtk.VBox): fgcolor_active = None fgcolor_inactive = None bgcolor = None + bgcolor_inactive = None palette_active = None palette_inactive = None @@ -754,6 +755,22 @@ class Terminal(Gtk.VBox): dbg(("fgcolor_inactive set to: RGB(%s,%s,%s)", getattr(self.fgcolor_inactive, "red"), getattr(self.fgcolor_inactive, "green"), getattr(self.fgcolor_inactive, "blue"))) + + bg_factor = self.config['inactive_bg_color_offset'] + if bg_factor > 1.0: + bg_factor = 1.0 + self.bgcolor_inactive = self.bgcolor.copy() + dbg(("bgcolor_inactive set to: RGB(%s,%s,%s)", getattr(self.bgcolor_inactive, "red"), + getattr(self.bgcolor_inactive, "green"), + getattr(self.bgcolor_inactive, "blue"))) + + for bit in ['red', 'green', 'blue']: + setattr(self.bgcolor_inactive, bit, + getattr(self.bgcolor_inactive, bit) * bg_factor) + dbg(("bgcolor_inactive set to: RGB(%s,%s,%s)", getattr(self.bgcolor_inactive, "red"), + getattr(self.bgcolor_inactive, "green"), + getattr(self.bgcolor_inactive, "blue"))) + colors = self.config['palette'].split(':') self.palette_active = [] for color in colors: @@ -789,7 +806,7 @@ class Terminal(Gtk.VBox): self.vte.set_colors(self.fgcolor_active, self.bgcolor, self.palette_active) else: - self.vte.set_colors(self.fgcolor_inactive, self.bgcolor, + self.vte.set_colors(self.fgcolor_inactive, self.bgcolor_inactive, self.palette_inactive) profiles = self.config.base.profiles terminal_box_style_context = self.terminalbox.get_style_context() @@ -1355,7 +1372,7 @@ class Terminal(Gtk.VBox): def on_vte_focus_out(self, _widget, _event): """Inform other parts of the application when focus is lost""" - self.vte.set_colors(self.fgcolor_inactive, self.bgcolor, + self.vte.set_colors(self.fgcolor_inactive, self.bgcolor_inactive, self.palette_inactive) self.set_cursor_color() self.emit('focus-out')