Fixes the transparent scrollbars for Ambiance.

This commit is contained in:
Stephen Boddy 2016-12-11 05:46:02 +01:00
parent f03cdd007f
commit f02f38389c
3 changed files with 43 additions and 1 deletions

View File

@ -734,6 +734,16 @@ class Terminal(Gtk.VBox):
else:
self.vte.set_colors(self.fgcolor_inactive, self.bgcolor,
self.palette_inactive)
profiles = self.config.base.profiles
terminal_box_style_context = self.terminalbox.get_style_context()
for profile in profiles.keys():
munged_profile = "terminator-profile-%s" % (
"".join([c if c.isalnum() else "-" for c in profile]))
if terminal_box_style_context.has_class(munged_profile):
terminal_box_style_context.remove_class(munged_profile)
munged_profile = "".join([c if c.isalnum() else "-" for c in self.get_profile()])
css_class_name = "terminator-profile-%s" % (munged_profile)
terminal_box_style_context.add_class(css_class_name)
self.set_cursor_color()
self.vte.set_cursor_shape(getattr(Vte.CursorShape,
self.config['cursor_shape'].upper()));

View File

@ -5,7 +5,9 @@
import copy
import os
from gi.repository import Gtk, Gdk
import gi
gi.require_version('Vte', '2.91')
from gi.repository import Gtk, Gdk, Vte
import borg
from borg import Borg
@ -404,6 +406,30 @@ class Terminator(Borg):
background-color: transparent; }
"""
# Add per profile snippets for setting the background of the HBox
template = """
.terminator-profile-%s {
background-color: alpha(%s, %s); }
"""
profiles = self.config.base.profiles
for profile in profiles.keys():
if profiles[profile]['use_theme_colors']:
# FIXME: This dummy vte has different system colors to the real ones
bgcolor = Vte.Terminal().get_style_context().get_background_color(Gtk.StateType.NORMAL)
bgcolor = "#{0:02x}{1:02x}{2:02x}".format(int(bgcolor.red * 255),
int(bgcolor.green * 255),
int(bgcolor.blue * 255))
else:
bgcolor = Gdk.RGBA()
bgcolor = profiles[profile]['background_color']
if profiles[profile]['background_type'] == 'transparent':
bgalpha = profiles[profile]['background_darkness']
else:
bgalpha = "1"
munged_profile = "".join([c if c.isalnum() else "-" for c in profile])
css += template % (munged_profile, bgcolor, bgalpha)
style_provider = Gtk.CssProvider()
style_provider.load_from_data(css)
self.style_providers.append(style_provider)

View File

@ -0,0 +1,6 @@
.terminator-terminal-window .scrollbar.dragging:not(.slider),
.terminator-terminal-window .scrollbar:hover:not(.slider),
.terminator-terminal-window .scrollbar:not(.slider) {
background-color: alpha(@dark_bg_color,0);
}