Add config option for inactive background offset

This commit is contained in:
Kacper Kowalski 2023-02-03 14:59:36 +01:00
parent 3854a7c0e2
commit 6551dba9dc
3 changed files with 19 additions and 1 deletions

View File

@ -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'],

View File

@ -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.

View File

@ -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,