From 6551dba9dc6ee859b24c842081ef5fbd4586356a Mon Sep 17 00:00:00 2001 From: Kacper Kowalski Date: Fri, 3 Feb 2023 14:59:36 +0100 Subject: [PATCH] Add config option for inactive background offset --- terminatorlib/config.py | 1 + terminatorlib/prefseditor.py | 15 +++++++++++++++ terminatorlib/terminal.py | 4 +++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 80c29cbd..a4c310e7 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': 0.8, 'enabled_plugins' : ['LaunchpadBugURLHandler', 'LaunchpadCodeURLHandler', 'APTURLHandler'], diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index a333069f..1bc7b664 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']) @@ -1294,6 +1298,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 936bbc3e..33246410 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -756,7 +756,9 @@ class Terminal(Gtk.VBox): getattr(self.fgcolor_inactive, "green"), getattr(self.fgcolor_inactive, "blue"))) - bg_factor = 0.8 + bg_factor = self.config['inactive_bg_color_offset'] + if bg_factor > 1.0: + bg_factor = 1.0 self.bgcolor_inactive = self.bgcolor.copy() for bit in ['red', 'green', 'blue']: setattr(self.bgcolor_inactive, bit,