From 3854a7c0e2fb61fda7d683021735fe83cd3dce4d Mon Sep 17 00:00:00 2001 From: Kacper Kowalski Date: Fri, 3 Feb 2023 14:34:16 +0100 Subject: [PATCH 1/6] Allow setting hardcoded background darkening Normally, one can only change the background of the foreground for the inactive window. With this change the background of the inactive window will also change it's brightness by 20%. --- terminatorlib/terminal.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 9f633a66..936bbc3e 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,13 @@ 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 = 0.8 + self.bgcolor_inactive = self.bgcolor.copy() + for bit in ['red', 'green', 'blue']: + setattr(self.bgcolor_inactive, bit, + getattr(self.bgcolor_inactive, bit) * bg_factor) + colors = self.config['palette'].split(':') self.palette_active = [] for color in colors: @@ -789,7 +797,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() @@ -1314,7 +1322,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') From 6551dba9dc6ee859b24c842081ef5fbd4586356a Mon Sep 17 00:00:00 2001 From: Kacper Kowalski Date: Fri, 3 Feb 2023 14:59:36 +0100 Subject: [PATCH 2/6] 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, From 272328c82d597f44c907c0fcf497b85b7e845cee Mon Sep 17 00:00:00 2001 From: Kacper Kowalski Date: Fri, 3 Feb 2023 15:50:33 +0100 Subject: [PATCH 3/6] Add inactive background color adjustment in prefs --- terminatorlib/preferences.glade | 177 +++++++++++++++++++++----------- 1 file changed, 116 insertions(+), 61 deletions(-) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 57dc3620..f1a61b7c 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -340,6 +340,11 @@ 0.10 0.20 + + 1 + 0.10 + 0.20 + 1 2 @@ -887,7 +892,7 @@ 36 True - + True False @@ -906,7 +911,7 @@ 0 - 3 + 4 3 @@ -960,7 +965,7 @@ True baseline True - adjustment7 + adjustment8 2 2 False @@ -1030,7 +1035,7 @@ 0 - 5 + 6 @@ -1046,7 +1051,7 @@ 1 - 5 + 6 @@ -1064,7 +1069,7 @@ 2 - 5 + 6 @@ -1081,7 +1086,7 @@ 2 - 4 + 5 @@ -1097,7 +1102,7 @@ 1 - 4 + 5 @@ -1109,7 +1114,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 @@ -3721,12 +3771,12 @@ - + False + True True - False - filter keybindings + filter keybindings False @@ -3734,68 +3784,73 @@ 0 - - - True - True - adjustment4 - never - in - + True True - True - KeybindingsListStore - False - 0 - - - + adjustment4 + never + in - - Name - - - - 0 - + + True + True + True + KeybindingsListStore + False + 0 + + - - - - - Action - - - 1 - - - - - - - Keybinding - - - True - other - - + + Name + + + + 0 + + + + + + + Action + + + + 1 + + + + + + + Keybinding + + + True + other + + + + + 2 + 3 + + - - 2 - 3 - + + True + True + 1 + - - 3 From dd511778c823ea942380a37bd913766157ea6c07 Mon Sep 17 00:00:00 2001 From: Kacper Kowalski Date: Fri, 3 Feb 2023 15:56:46 +0100 Subject: [PATCH 4/6] Add debug messages for the inactive background color change --- terminatorlib/terminal.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 33246410..3c338ab8 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -760,9 +760,16 @@ class Terminal(Gtk.VBox): 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 = [] From 39cf34e295f107bd22d81da67f463220d938ad25 Mon Sep 17 00:00:00 2001 From: Kacper Kowalski Date: Fri, 3 Feb 2023 18:26:54 +0100 Subject: [PATCH 5/6] Fix typo --- terminatorlib/preferences.glade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index f1a61b7c..c0e29147 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -1121,7 +1121,7 @@ True False - Unfocused terminal background color + Unfocused terminal background color: 0 From c1d9253acc8e29897947037269b17fe7c52080e0 Mon Sep 17 00:00:00 2001 From: Kacper Kowalski Date: Tue, 21 Feb 2023 11:04:37 +0100 Subject: [PATCH 6/6] Make inactive background brightness default 1.0 (100%) --- terminatorlib/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index a4c310e7..90f4a3ad 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -103,7 +103,7 @@ DEFAULTS = { 'custom_url_handler' : '', 'disable_real_transparency' : False, 'inactive_color_offset': 0.8, - 'inactive_bg_color_offset': 0.8, + 'inactive_bg_color_offset': 1.0, 'enabled_plugins' : ['LaunchpadBugURLHandler', 'LaunchpadCodeURLHandler', 'APTURLHandler'],