Add theme specific css file loading (from terminatorlib/themes and ~/.local/share/themes), move Adwaita fix into own file

This commit is contained in:
Stephen Boddy 2016-12-09 22:47:44 +01:00
parent d1b2f45d56
commit 1ff0ec1ba9
3 changed files with 22 additions and 13 deletions

View File

@ -7,6 +7,7 @@ import copy
import os import os
from gi.repository import Gtk, Gdk from gi.repository import Gtk, Gdk
import borg
from borg import Borg from borg import Borg
from config import Config from config import Config
from keybindings import Keybindings from keybindings import Keybindings
@ -398,23 +399,27 @@ class Terminator(Borg):
self.style_providers.append(style_provider) self.style_providers.append(style_provider)
# Attempt to load some theme specific stylistic tweaks for appearances # Attempt to load some theme specific stylistic tweaks for appearances
# Shamelessly cribbed from GNOME-Terminal usr_theme_dir = os.path.expanduser('~/.local/share/themes')
style_provider = Gtk.CssProvider() (head, _tail) = os.path.split(borg.__file__)
style_provider.load_from_path('terminatorlib/terminator.css') app_theme_dir = os.path.join(head, 'themes')
# Disabled for now. Needs to be theme dependant, and this is Ambiance
# only. Looks like crap on Adwaita :-)
#self.style_providers.append(style_provider)
# Fix Adwaita dumb-ass oversized hover on handle. settings=Gtk.Settings().get_default()
css = """ theme_name = settings.get_property('gtk-theme_name')
GtkPaned { for theme_dir in [usr_theme_dir, app_theme_dir]:
margin: 0 0 0 0; path_to_theme_specific_css = os.path.join(theme_dir,
padding: 0 0 0 0; } theme_name,
""" 'gtk-3.0/apps',
'terminator.css')
if os.path.isfile(path_to_theme_specific_css):
print path_to_theme_specific_css, os.path.isfile(path_to_theme_specific_css)
style_provider = Gtk.CssProvider()
style_provider.load_from_path(path_to_theme_specific_css)
self.style_providers.append(style_provider)
break
# Size the GtkPaned splitter handle size. # Size the GtkPaned splitter handle size.
if self.config['handle_size'] in xrange(0, 21): if self.config['handle_size'] in xrange(0, 21):
css += """ css = """
GtkPaned { GtkPaned {
-GtkPaned-handle-size: %s; } -GtkPaned-handle-size: %s; }
""" % self.config['handle_size'] """ % self.config['handle_size']

View File

@ -0,0 +1,4 @@
GtkPaned {
margin: 0 0 0 0;
padding: 0 0 0 0; }