Allow font dimming in inactive terminals
This commit is contained in:
parent
8fb3d5a19d
commit
780c295cf0
|
@ -1,3 +1,6 @@
|
|||
terminator 0.97:
|
||||
* Allow font dimming in inactive terminals
|
||||
|
||||
terminator 0.96:
|
||||
* Unity support for opening new windows (Lucian Adrian Grijincu)
|
||||
* Fix searching with infinite scrollback (Julien Thewys #755077)
|
||||
|
|
|
@ -102,6 +102,11 @@ Default value: \fB'#000000'\fR
|
|||
Sets the colour of the background of the titlebar of any terminal that will \fBnot\fR receive input from the active terminal.
|
||||
Default value: \fB'#C0BEBF'\fR
|
||||
.TP
|
||||
.B inactive_color_offset
|
||||
Controls how much to reduce the colour values of fonts in terminals that do not have focus. It is a simple multiplication
|
||||
factor. A font colour that was RGB(200,200,200) with an inactive_color_offset of 0.5 would set inactive terminals to
|
||||
RGB(100,100,100).
|
||||
.TP
|
||||
.B enabled_plugins
|
||||
A list of plugins which should be loaded by default. All other plugin classes will be ignored. The default value includes two
|
||||
plugins related to Launchpad, which are enabled by default to provide continuity with earlier releases where these were the
|
||||
|
|
|
@ -98,6 +98,7 @@ DEFAULTS = {
|
|||
'title_receive_bg_color' : '#0076c9',
|
||||
'title_inactive_fg_color' : '#000000',
|
||||
'title_inactive_bg_color' : '#c0bebf',
|
||||
'inactive_color_offset': 0.8,
|
||||
'enabled_plugins' : ['LaunchpadBugURLHandler',
|
||||
'LaunchpadCodeURLHandler',
|
||||
'APTURLHandler'],
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -457,6 +457,9 @@ class PrefsEditor:
|
|||
'title_inactive_fg_color', 'title_inactive_bg_color']:
|
||||
widget = guiget(bit)
|
||||
widget.set_color(gtk.gdk.Color(self.config[bit]))
|
||||
# Inactive terminal shading
|
||||
widget = guiget('inactive_color_offset')
|
||||
widget.set_value(float(self.config['inactive_color_offset']))
|
||||
|
||||
## Background tab
|
||||
# Radio values
|
||||
|
@ -881,6 +884,11 @@ class PrefsEditor:
|
|||
self.config['title_transmit_fg_color'] = color2hex(widget)
|
||||
self.config.save()
|
||||
|
||||
def on_inactive_color_offset_change_value(self, widget, scroll, value):
|
||||
"""Inactive color offset setting changed"""
|
||||
self.config['inactive_color_offset'] = round(value, 2)
|
||||
self.config.save()
|
||||
|
||||
def on_handlesize_change_value(self, widget, scroll, value):
|
||||
"""Handle size changed"""
|
||||
value = int(value)
|
||||
|
|
|
@ -56,6 +56,7 @@ class Terminal(gtk.VBox):
|
|||
(gobject.TYPE_BOOLEAN, gobject.TYPE_OBJECT)),
|
||||
'tab-top-new': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
'focus-in': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
'focus-out': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
'zoom': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
'maximise': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
'unzoom': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
|
@ -95,6 +96,12 @@ class Terminal(gtk.VBox):
|
|||
custom_font_size = None
|
||||
layout_command = None
|
||||
|
||||
fgcolor_active = None
|
||||
fgcolor_inactive = None
|
||||
bgcolor = None
|
||||
palette_active = None
|
||||
palette_inactive = None
|
||||
|
||||
composite_support = None
|
||||
|
||||
cnxids = None
|
||||
|
@ -346,6 +353,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
self.emit('title-change', self.get_window_title()))
|
||||
self.vte.connect('grab-focus', self.on_vte_focus)
|
||||
self.vte.connect('focus-in-event', self.on_vte_focus_in)
|
||||
self.vte.connect('focus-out-event', self.on_vte_focus_out)
|
||||
self.vte.connect('size-allocate', self.deferred_on_vte_size_allocate)
|
||||
|
||||
self.vte.add_events(gtk.gdk.ENTER_NOTIFY_MASK)
|
||||
|
@ -602,28 +610,34 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
pass
|
||||
self.vte.set_allow_bold(self.config['allow_bold'])
|
||||
if self.config['use_theme_colors']:
|
||||
fgcolor = self.vte.get_style().text[gtk.STATE_NORMAL]
|
||||
bgcolor = self.vte.get_style().base[gtk.STATE_NORMAL]
|
||||
self.fgcolor_active = self.vte.get_style().text[gtk.STATE_NORMAL]
|
||||
self.bgcolor = self.vte.get_style().base[gtk.STATE_NORMAL]
|
||||
else:
|
||||
fgcolor = gtk.gdk.color_parse(self.config['foreground_color'])
|
||||
bgcolor = gtk.gdk.color_parse(self.config['background_color'])
|
||||
self.fgcolor_active = gtk.gdk.color_parse(self.config['foreground_color'])
|
||||
self.bgcolor = gtk.gdk.color_parse(self.config['background_color'])
|
||||
|
||||
factor = self.config['inactive_color_offset']
|
||||
self.fgcolor_inactive = self.fgcolor_active.copy()
|
||||
|
||||
for bit in ['red', 'green', 'blue']:
|
||||
setattr(self.fgcolor_inactive, bit,
|
||||
getattr(self.fgcolor_inactive, bit) * factor)
|
||||
|
||||
colors = self.config['palette'].split(':')
|
||||
palette = []
|
||||
self.palette_active = []
|
||||
self.palette_inactive = []
|
||||
for color in colors:
|
||||
if color:
|
||||
palette.append(gtk.gdk.color_parse(color))
|
||||
self.vte.set_colors(fgcolor, bgcolor, palette)
|
||||
if self.config['cursor_color'] == self.config['foreground_color']:
|
||||
try:
|
||||
self.vte.set_color_cursor(None)
|
||||
except TypeError:
|
||||
# FIXME: I think this is only necessary because of
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=614910
|
||||
pass
|
||||
elif self.config['cursor_color'] != '':
|
||||
self.vte.set_color_cursor(gtk.gdk.color_parse(
|
||||
self.config['cursor_color']))
|
||||
newcolor = gtk.gdk.color_parse(color)
|
||||
newcolor_inactive = newcolor.copy()
|
||||
for bit in ['red', 'green', 'blue']:
|
||||
setattr(newcolor_inactive, bit,
|
||||
getattr(newcolor_inactive, bit) * factor)
|
||||
self.palette_active.append(newcolor)
|
||||
self.palette_inactive.append(newcolor_inactive)
|
||||
self.vte.set_colors(self.fgcolor_active, self.bgcolor,
|
||||
self.palette_active)
|
||||
self.set_cursor_color()
|
||||
if hasattr(self.vte, 'set_cursor_shape'):
|
||||
self.vte.set_cursor_shape(getattr(vte, 'CURSOR_SHAPE_' +
|
||||
self.config['cursor_shape'].upper()))
|
||||
|
@ -730,6 +744,19 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
self.titlebar.update()
|
||||
self.vte.queue_draw()
|
||||
|
||||
def set_cursor_color(self):
|
||||
"""Set the cursor color appropriately"""
|
||||
if self.config['cursor_color'] == self.config['foreground_color']:
|
||||
try:
|
||||
self.vte.set_color_cursor(None)
|
||||
except TypeError:
|
||||
# FIXME: I think this is only necessary because of
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=614910
|
||||
pass
|
||||
elif self.config['cursor_color'] != '':
|
||||
self.vte.set_color_cursor(gtk.gdk.color_parse(
|
||||
self.config['cursor_color']))
|
||||
|
||||
def get_window_title(self):
|
||||
"""Return the window title"""
|
||||
return(self.vte.get_window_title() or str(self.command))
|
||||
|
@ -1009,8 +1036,18 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
|
||||
def on_vte_focus_in(self, _widget, _event):
|
||||
"""Inform other parts of the application when focus is received"""
|
||||
self.vte.set_colors(self.fgcolor_active, self.bgcolor,
|
||||
self.palette_active)
|
||||
self.set_cursor_color()
|
||||
self.emit('focus-in')
|
||||
|
||||
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.palette_inactive)
|
||||
self.set_cursor_color()
|
||||
self.emit('focus-out')
|
||||
|
||||
def on_window_focus_out(self):
|
||||
"""Update our UI when the window loses focus"""
|
||||
self.titlebar.update('window-focus-out')
|
||||
|
|
Loading…
Reference in New Issue