Merge pull request #709 from KKoovalsky/master
Better distinguishing of inactive windows from the active one, by changing the background brightness
This commit is contained in:
commit
380be99c9f
|
@ -103,6 +103,7 @@ DEFAULTS = {
|
||||||
'custom_url_handler' : '',
|
'custom_url_handler' : '',
|
||||||
'disable_real_transparency' : False,
|
'disable_real_transparency' : False,
|
||||||
'inactive_color_offset': 0.8,
|
'inactive_color_offset': 0.8,
|
||||||
|
'inactive_bg_color_offset': 1.0,
|
||||||
'enabled_plugins' : ['LaunchpadBugURLHandler',
|
'enabled_plugins' : ['LaunchpadBugURLHandler',
|
||||||
'LaunchpadCodeURLHandler',
|
'LaunchpadCodeURLHandler',
|
||||||
'APTURLHandler'],
|
'APTURLHandler'],
|
||||||
|
|
|
@ -394,6 +394,11 @@
|
||||||
<property name="step-increment">0.10</property>
|
<property name="step-increment">0.10</property>
|
||||||
<property name="page-increment">0.20</property>
|
<property name="page-increment">0.20</property>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="adjustment8">
|
||||||
|
<property name="upper">1</property>
|
||||||
|
<property name="step-increment">0.10</property>
|
||||||
|
<property name="page-increment">0.20</property>
|
||||||
|
</object>
|
||||||
<object class="GtkAdjustment" id="adjustment_cellheight">
|
<object class="GtkAdjustment" id="adjustment_cellheight">
|
||||||
<property name="lower">1</property>
|
<property name="lower">1</property>
|
||||||
<property name="upper">2</property>
|
<property name="upper">2</property>
|
||||||
|
@ -941,7 +946,7 @@
|
||||||
<property name="spacing">36</property>
|
<property name="spacing">36</property>
|
||||||
<property name="homogeneous">True</property>
|
<property name="homogeneous">True</property>
|
||||||
<child>
|
<child>
|
||||||
<!-- n-columns=3 n-rows=6 -->
|
<!-- n-columns=3 n-rows=7 -->
|
||||||
<object class="GtkGrid" id="grid3">
|
<object class="GtkGrid" id="grid3">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
|
@ -960,7 +965,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">3</property>
|
<property name="top-attach">4</property>
|
||||||
<property name="width">3</property>
|
<property name="width">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -1014,7 +1019,7 @@
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="halign">baseline</property>
|
<property name="halign">baseline</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="adjustment">adjustment7</property>
|
<property name="adjustment">adjustment8</property>
|
||||||
<property name="round-digits">2</property>
|
<property name="round-digits">2</property>
|
||||||
<property name="digits">2</property>
|
<property name="digits">2</property>
|
||||||
<property name="draw-value">False</property>
|
<property name="draw-value">False</property>
|
||||||
|
@ -1084,7 +1089,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">5</property>
|
<property name="top-attach">6</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1100,7 +1105,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
<property name="top-attach">5</property>
|
<property name="top-attach">6</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1118,7 +1123,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">2</property>
|
<property name="left-attach">2</property>
|
||||||
<property name="top-attach">5</property>
|
<property name="top-attach">6</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1135,7 +1140,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">2</property>
|
<property name="left-attach">2</property>
|
||||||
<property name="top-attach">4</property>
|
<property name="top-attach">5</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1151,7 +1156,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
<property name="top-attach">4</property>
|
<property name="top-attach">5</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1163,7 +1168,52 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">4</property>
|
<property name="top-attach">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label35">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Unfocused terminal background color:</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="inactive_bg_color_offset_value_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">100%</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
<property name="width-chars">5</property>
|
||||||
|
<property name="max-width-chars">5</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScale" id="inactive_bg_color_offset">
|
||||||
|
<property name="width-request">100</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="adjustment">adjustment7</property>
|
||||||
|
<property name="round-digits">2</property>
|
||||||
|
<property name="digits">2</property>
|
||||||
|
<property name="draw-value">False</property>
|
||||||
|
<property name="value-pos">bottom</property>
|
||||||
|
<signal name="value-changed" handler="on_inactive_bg_color_offset_value_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -674,6 +674,10 @@ class PrefsEditor:
|
||||||
widget.set_value(float(self.config['inactive_color_offset']))
|
widget.set_value(float(self.config['inactive_color_offset']))
|
||||||
widget = guiget('inactive_color_offset_value_label')
|
widget = guiget('inactive_color_offset_value_label')
|
||||||
widget.set_text('%d%%' % (int(float(self.config['inactive_color_offset'])*100)))
|
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)
|
# Open links with a single click (instead of a Ctrl-left click)
|
||||||
widget = guiget('link_single_click')
|
widget = guiget('link_single_click')
|
||||||
widget.set_active(self.config['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 = guiget('inactive_color_offset_value_label')
|
||||||
label_widget.set_text('%d%%' % (int(value * 100)))
|
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):
|
def on_handlesize_value_changed(self, widget):
|
||||||
"""Handle size changed"""
|
"""Handle size changed"""
|
||||||
value = widget.get_value() # This one is rounded according to the UI.
|
value = widget.get_value() # This one is rounded according to the UI.
|
||||||
|
|
|
@ -112,6 +112,7 @@ class Terminal(Gtk.VBox):
|
||||||
fgcolor_active = None
|
fgcolor_active = None
|
||||||
fgcolor_inactive = None
|
fgcolor_inactive = None
|
||||||
bgcolor = None
|
bgcolor = None
|
||||||
|
bgcolor_inactive = None
|
||||||
palette_active = None
|
palette_active = None
|
||||||
palette_inactive = 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"),
|
dbg(("fgcolor_inactive set to: RGB(%s,%s,%s)", getattr(self.fgcolor_inactive, "red"),
|
||||||
getattr(self.fgcolor_inactive, "green"),
|
getattr(self.fgcolor_inactive, "green"),
|
||||||
getattr(self.fgcolor_inactive, "blue")))
|
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(':')
|
colors = self.config['palette'].split(':')
|
||||||
self.palette_active = []
|
self.palette_active = []
|
||||||
for color in colors:
|
for color in colors:
|
||||||
|
@ -789,7 +806,7 @@ class Terminal(Gtk.VBox):
|
||||||
self.vte.set_colors(self.fgcolor_active, self.bgcolor,
|
self.vte.set_colors(self.fgcolor_active, self.bgcolor,
|
||||||
self.palette_active)
|
self.palette_active)
|
||||||
else:
|
else:
|
||||||
self.vte.set_colors(self.fgcolor_inactive, self.bgcolor,
|
self.vte.set_colors(self.fgcolor_inactive, self.bgcolor_inactive,
|
||||||
self.palette_inactive)
|
self.palette_inactive)
|
||||||
profiles = self.config.base.profiles
|
profiles = self.config.base.profiles
|
||||||
terminal_box_style_context = self.terminalbox.get_style_context()
|
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):
|
def on_vte_focus_out(self, _widget, _event):
|
||||||
"""Inform other parts of the application when focus is lost"""
|
"""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.palette_inactive)
|
||||||
self.set_cursor_color()
|
self.set_cursor_color()
|
||||||
self.emit('focus-out')
|
self.emit('focus-out')
|
||||||
|
|
Loading…
Reference in New Issue