From d9c6c9c4969619478d37bad790e84e8d6e583acc Mon Sep 17 00:00:00 2001 From: "Braden M. Kelley" Date: Fri, 8 Jul 2016 12:04:54 +0200 Subject: [PATCH 01/18] Fix transparency for newer versions of GTK --- terminatorlib/terminator.py | 23 +++++++++++++++-------- terminatorlib/window.py | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 97f6f3f9..ab2decb1 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -372,19 +372,26 @@ class Terminator(Borg): Gtk.StyleContext.remove_provider_for_screen( Gdk.Screen.get_default(), self.style_provider) - self.style_provider = None + + css = """ + .terminator-terminal-window { + background-color: rgba(0,0,0,0); + } + """ + if self.config['handle_size'] in xrange(0, 6): - css = """ + css += """ GtkPaned { -GtkPaned-handle-size: %s } """ % self.config['handle_size'] - self.style_provider = Gtk.CssProvider() - self.style_provider.load_from_data(css) - Gtk.StyleContext.add_provider_for_screen( - Gdk.Screen.get_default(), - self.style_provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + self.style_provider = Gtk.CssProvider() + self.style_provider.load_from_data(css) + Gtk.StyleContext.add_provider_for_screen( + Gdk.Screen.get_default(), + self.style_provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) # Cause all the terminals to reconfigure for terminal in self.terminals: diff --git a/terminatorlib/window.py b/terminatorlib/window.py index f6f38e59..cef9fdbf 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -64,6 +64,8 @@ class Window(Container, Gtk.Window): GObject.type_register(Window) self.register_signals(Window) + self.get_style_context().add_class("terminator-terminal-window") + # self.set_property('allow-shrink', True) # FIXME FOR GTK3, or do we need this actually? icon_to_apply='' From b2e81d8f38b201a001ca881b1f9c167c0982068f Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Thu, 8 Dec 2016 03:22:59 +0100 Subject: [PATCH 02/18] Very rough preliminary css styling work, showing the general principles --- terminatorlib/searchbar.py | 2 + terminatorlib/terminator.css | 110 +++++++++++++++++++++++++++++++++++ terminatorlib/terminator.py | 65 +++++++++++++++------ 3 files changed, 160 insertions(+), 17 deletions(-) create mode 100644 terminatorlib/terminator.css diff --git a/terminatorlib/searchbar.py b/terminatorlib/searchbar.py index d3088405..af615dd1 100755 --- a/terminatorlib/searchbar.py +++ b/terminatorlib/searchbar.py @@ -39,6 +39,8 @@ class Searchbar(Gtk.HBox): self.config = Config() + self.get_style_context().add_class("terminator-terminal-searchbar") + # Search text self.entry = Gtk.Entry() self.entry.set_activates_default(True) diff --git a/terminatorlib/terminator.css b/terminatorlib/terminator.css new file mode 100644 index 00000000..3ecdf5d0 --- /dev/null +++ b/terminatorlib/terminator.css @@ -0,0 +1,110 @@ +/* +Some basic playing copying out the GNOME-Terminal style tab headers. + +Might want to have a seperate option for "shrinking" the tabs, by +nuking the padding/borders in the tabs. +*/ + +/* +GtkNotebook.header { + background-color: rgba(90%,20%,30%,1); + border: none; +} + +.notebook.header { + background-color: rgba(90%,20%,30%,1); + border: none; +} + +*/ + +.notebook tab.top { padding: 4px 6px 2px 6px; } +.notebook tab.top:active { padding-bottom: 3px; } +.notebook tab.bottom { padding: 2px 6px 4px 6px; } +.notebook tab.bottom:active { padding-top: 3px; } +.notebook tab.left { padding: 2px 4px 2px 6px; } +.notebook tab.left:active { padding-right: 5px; } +.notebook tab.right { padding: 2px 6px 2px 4px; } +.notebook tab.right:active { padding-left: 5px; } + +/* give active tab a background, as it might be dragged across of others when reordering */ +.notebook tab:active { + background-color: @bg_color; +} + +.notebook.header { + border-width: 0; /* set below depending on position of tab bar */ + border-color: shade (@bg_color, 0.82); + border-style: solid; + /* background-color: rgba(90%,20%,30%,1); */ + background-color: @dark_bg_color; +} + +/* Draw a border between tabs and content ... */ +.notebook.header.top { border-bottom-width: 1px; } +.notebook.header.right { border-left-width: 1px; } +.notebook.header.left { border-right-width: 1px; } +.notebook.header.bottom { border-top-width: 1px; } + +/* ... unless the content is in a frame (thus having a border itself */ +.notebook.header.frame.top { border: none; } +.notebook.header.frame.right { border: none; } +.notebook.header.frame.right { border: none; } +.notebook.header.frame.bottom { border: none; } + +.notebook tab.top { + background-color: shade(@bg_color, 0.7); + border-width: 1px 1px 0px 1px; + border-radius: 8px 8px 0px 0px; + border-image: none; + border-style: solid; + border-color: @dark_bg_color; + +} + +.notebook tab.top:active { + background-color: @bg_color; + border-image: none; +} + +.notebook tab .button { + background-color: transparent; + padding: 1px; +} + +.notebook tab.right { + border-image: -gtk-gradient (linear, right top, left top, + from (alpha (shade (@bg_color, 0.9), 0.0)), + to (shade (@bg_color, 0.9))) 1; + border-image-width: 1px 0; +} + +.notebook tab.left { + border-image: -gtk-gradient (linear, left top, right top, + from (alpha (shade (@bg_color, 0.9), 0.0)), + to (shade (@bg_color, 0.9))) 1; + border-image-width: 1px 0; +} + +.notebook tab.bottom { + border-image: -gtk-gradient (linear, left bottom, left top, + from (alpha (shade (@bg_color, 0.9), 0.0)), + to (shade (@bg_color, 0.9))) 1; + border-image-width: 0 1px; +} + +/* Draw a focus ring around labels in tabs */ +.notebook tab GtkLabel { + border: 1px solid transparent; + border-radius: 5px; +} + +.notebook:focus tab GtkLabel.active-page { + border-color: @focus_color; + background-color: @focus_bg_color; +} + +.notebook GtkDrawingArea { + background-color: shade (@bg_color, 1.02); +} + diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index ab2decb1..74956d80 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -39,7 +39,7 @@ class Terminator(Borg): groups = None config = None keybindings = None - style_provider = None + style_providers = None last_focused_term = None origcwd = None @@ -81,6 +81,8 @@ class Terminator(Borg): if not self.keybindings: self.keybindings = Keybindings() self.keybindings.configure(self.config['keybindings']) + if not self.style_providers: + self.style_providers = [] if not self.doing_layout: self.doing_layout = False if not self.pid_cwd: @@ -368,30 +370,59 @@ class Terminator(Borg): def reconfigure(self): """Update configuration for the whole application""" - if self.style_provider is not None: - Gtk.StyleContext.remove_provider_for_screen( - Gdk.Screen.get_default(), - self.style_provider) + if self.style_providers != []: + for style_provider in self.style_providers: + Gtk.StyleContext.remove_provider_for_screen( + Gdk.Screen.get_default(), + style_provider) + self.style_providers = [] + # Force the window background to be transparent for newer versions of + # GTK3. We then have to fix all the widget backgrounds because the + # widgets theming may not render it's own background. css = """ .terminator-terminal-window { - background-color: rgba(0,0,0,0); - } + background-color: rgba(0,0,0,0); } + + .notebook.header { + background-color: @bg_color; } + + .pane-separator { + background-color: @bg_color; } + + .terminator-terminal-searchbar { + background-color: @bg_color; } """ + style_provider = Gtk.CssProvider() + style_provider.load_from_data(css) + self.style_providers.append(style_provider) - if self.config['handle_size'] in xrange(0, 6): - css += """ + # Attempt to load some theme specific stylistic tweaks for appearances + # Shamelessly cribbed from GNOME-Terminal + style_provider = Gtk.CssProvider() + style_provider.load_from_path('terminatorlib/terminator.css') + self.style_providers.append(style_provider) + + # Size the GtkPaned splitter handle size and fix Adwaita dumb-ass + # oversized hover on handle. + if self.config['handle_size'] in xrange(0, 21): + css = """ GtkPaned { - -GtkPaned-handle-size: %s - } + -GtkPaned-handle-size: %s; + margin: 0 0 0 0; + padding: 0 0 0 0; } """ % self.config['handle_size'] + style_provider = Gtk.CssProvider() + style_provider.load_from_data(css) + self.style_providers.append(style_provider) - self.style_provider = Gtk.CssProvider() - self.style_provider.load_from_data(css) - Gtk.StyleContext.add_provider_for_screen( - Gdk.Screen.get_default(), - self.style_provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + # Apply the providers, incrementing priority so they don't cancel out + # each other + for idx in xrange(0, len(self.style_providers)): + Gtk.StyleContext.add_provider_for_screen( + Gdk.Screen.get_default(), + self.style_providers[idx], + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION+idx) # Cause all the terminals to reconfigure for terminal in self.terminals: From d1b2f45d56e8e7ae5aed810220c54e135f477af1 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Thu, 8 Dec 2016 18:31:42 +0100 Subject: [PATCH 03/18] Fix the colours to use public ones, and make Adwaita hover fix consistent. --- terminatorlib/terminator.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index ecd8000c..fbda8a50 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -382,16 +382,16 @@ class Terminator(Borg): # widgets theming may not render it's own background. css = """ .terminator-terminal-window { - background-color: rgba(0,0,0,0); } + background-color: alpha(@theme_bg_color,0); } .notebook.header { - background-color: @bg_color; } + background-color: @theme_bg_color; } .pane-separator { - background-color: @bg_color; } + background-color: @theme_bg_color; } .terminator-terminal-searchbar { - background-color: @bg_color; } + background-color: @theme_bg_color; } """ style_provider = Gtk.CssProvider() style_provider.load_from_data(css) @@ -401,20 +401,26 @@ class Terminator(Borg): # Shamelessly cribbed from GNOME-Terminal style_provider = Gtk.CssProvider() style_provider.load_from_path('terminatorlib/terminator.css') - self.style_providers.append(style_provider) + # Disabled for now. Needs to be theme dependant, and this is Ambiance + # only. Looks like crap on Adwaita :-) + #self.style_providers.append(style_provider) - # Size the GtkPaned splitter handle size and fix Adwaita dumb-ass - # oversized hover on handle. + # Fix Adwaita dumb-ass oversized hover on handle. + css = """ + GtkPaned { + margin: 0 0 0 0; + padding: 0 0 0 0; } + """ + + # Size the GtkPaned splitter handle size. if self.config['handle_size'] in xrange(0, 21): - css = """ + css += """ GtkPaned { - -GtkPaned-handle-size: %s; - margin: 0 0 0 0; - padding: 0 0 0 0; } + -GtkPaned-handle-size: %s; } """ % self.config['handle_size'] - style_provider = Gtk.CssProvider() - style_provider.load_from_data(css) - self.style_providers.append(style_provider) + style_provider = Gtk.CssProvider() + style_provider.load_from_data(css) + self.style_providers.append(style_provider) # Apply the providers, incrementing priority so they don't cancel out # each other From 1ff0ec1ba997b773cf037bbc6c3ac204222346c2 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Fri, 9 Dec 2016 22:47:44 +0100 Subject: [PATCH 04/18] Add theme specific css file loading (from terminatorlib/themes and ~/.local/share/themes), move Adwaita fix into own file --- terminatorlib/terminator.py | 31 +++++++++++-------- .../Adwaita/gtk-3.0/apps/terminator.css | 4 +++ .../Ambiance/gtk-3.0/apps}/terminator.css | 0 3 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 terminatorlib/themes/Adwaita/gtk-3.0/apps/terminator.css rename terminatorlib/{ => themes/Ambiance/gtk-3.0/apps}/terminator.css (100%) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index fbda8a50..0ee0a8be 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -7,6 +7,7 @@ import copy import os from gi.repository import Gtk, Gdk +import borg from borg import Borg from config import Config from keybindings import Keybindings @@ -398,23 +399,27 @@ class Terminator(Borg): self.style_providers.append(style_provider) # Attempt to load some theme specific stylistic tweaks for appearances - # Shamelessly cribbed from GNOME-Terminal - style_provider = Gtk.CssProvider() - style_provider.load_from_path('terminatorlib/terminator.css') - # Disabled for now. Needs to be theme dependant, and this is Ambiance - # only. Looks like crap on Adwaita :-) - #self.style_providers.append(style_provider) + usr_theme_dir = os.path.expanduser('~/.local/share/themes') + (head, _tail) = os.path.split(borg.__file__) + app_theme_dir = os.path.join(head, 'themes') - # Fix Adwaita dumb-ass oversized hover on handle. - css = """ - GtkPaned { - margin: 0 0 0 0; - padding: 0 0 0 0; } - """ + settings=Gtk.Settings().get_default() + theme_name = settings.get_property('gtk-theme_name') + for theme_dir in [usr_theme_dir, app_theme_dir]: + path_to_theme_specific_css = os.path.join(theme_dir, + 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. if self.config['handle_size'] in xrange(0, 21): - css += """ + css = """ GtkPaned { -GtkPaned-handle-size: %s; } """ % self.config['handle_size'] diff --git a/terminatorlib/themes/Adwaita/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Adwaita/gtk-3.0/apps/terminator.css new file mode 100644 index 00000000..c47de344 --- /dev/null +++ b/terminatorlib/themes/Adwaita/gtk-3.0/apps/terminator.css @@ -0,0 +1,4 @@ +GtkPaned { + margin: 0 0 0 0; + padding: 0 0 0 0; } + diff --git a/terminatorlib/terminator.css b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css similarity index 100% rename from terminatorlib/terminator.css rename to terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css From 8a3406051b39c4600d0ecbe512a566367ffbb2cd Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Fri, 9 Dec 2016 23:29:18 +0100 Subject: [PATCH 05/18] Fix the top left and right corners of the tab header background for Ambiance customisation --- terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css | 1 + 1 file changed, 1 insertion(+) diff --git a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css index 3ecdf5d0..ed04a7be 100644 --- a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css +++ b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css @@ -36,6 +36,7 @@ GtkNotebook.header { border-width: 0; /* set below depending on position of tab bar */ border-color: shade (@bg_color, 0.82); border-style: solid; + border-radius: 0px 0px 0px 0px; /* background-color: rgba(90%,20%,30%,1); */ background-color: @dark_bg_color; } From 0c1ec6467fc8e320fd3b916cfc26aa80114f7f3b Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Fri, 9 Dec 2016 23:59:23 +0100 Subject: [PATCH 06/18] Cleanup and rationalise the Ambiance customisations --- .../Ambiance/gtk-3.0/apps/terminator.css | 88 +++++++------------ 1 file changed, 33 insertions(+), 55 deletions(-) diff --git a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css index ed04a7be..5bbe9b04 100644 --- a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css +++ b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css @@ -5,39 +5,11 @@ Might want to have a seperate option for "shrinking" the tabs, by nuking the padding/borders in the tabs. */ -/* -GtkNotebook.header { - background-color: rgba(90%,20%,30%,1); - border: none; -} - -.notebook.header { - background-color: rgba(90%,20%,30%,1); - border: none; -} - -*/ - -.notebook tab.top { padding: 4px 6px 2px 6px; } -.notebook tab.top:active { padding-bottom: 3px; } -.notebook tab.bottom { padding: 2px 6px 4px 6px; } -.notebook tab.bottom:active { padding-top: 3px; } -.notebook tab.left { padding: 2px 4px 2px 6px; } -.notebook tab.left:active { padding-right: 5px; } -.notebook tab.right { padding: 2px 6px 2px 4px; } -.notebook tab.right:active { padding-left: 5px; } - -/* give active tab a background, as it might be dragged across of others when reordering */ -.notebook tab:active { - background-color: @bg_color; -} - .notebook.header { border-width: 0; /* set below depending on position of tab bar */ border-color: shade (@bg_color, 0.82); border-style: solid; border-radius: 0px 0px 0px 0px; - /* background-color: rgba(90%,20%,30%,1); */ background-color: @dark_bg_color; } @@ -53,19 +25,46 @@ GtkNotebook.header { .notebook.header.frame.right { border: none; } .notebook.header.frame.bottom { border: none; } -.notebook tab.top { + +.notebook tab { background-color: shade(@bg_color, 0.7); - border-width: 1px 1px 0px 1px; - border-radius: 8px 8px 0px 0px; border-image: none; border-style: solid; border-color: @dark_bg_color; - } -.notebook tab.top:active { +/* give active tab a background, as it might be dragged across of others when reordering */ +.notebook tab:active { background-color: @bg_color; - border-image: none; +} + +.notebook tab.top:active { padding-bottom: 3px; } +.notebook tab.bottom:active { padding-top: 3px; } +.notebook tab.left:active { padding-right: 5px; } +.notebook tab.right:active { padding-left: 5px; } + +.notebook tab.top { + padding: 4px 6px 2px 6px; + border-width: 1px 1px 0px 1px; + border-radius: 8px 8px 0px 0px; +} + +.notebook tab.bottom { + padding: 2px 6px 4px 6px; + border-width: 0px 1px 1px 1px; + border-radius: 0px 0px 8px 8px; +} + +.notebook tab.left { + padding: 2px 4px 2px 6px; + border-width: 1px 0px 1px 1px; + border-radius: 8px 0px 0px 8px; +} + +.notebook tab.right { + padding: 2px 6px 2px 4px; + border-width: 1px 1px 1px 0px; + border-radius: 0px 8px 8px 0px; } .notebook tab .button { @@ -73,27 +72,6 @@ GtkNotebook.header { padding: 1px; } -.notebook tab.right { - border-image: -gtk-gradient (linear, right top, left top, - from (alpha (shade (@bg_color, 0.9), 0.0)), - to (shade (@bg_color, 0.9))) 1; - border-image-width: 1px 0; -} - -.notebook tab.left { - border-image: -gtk-gradient (linear, left top, right top, - from (alpha (shade (@bg_color, 0.9), 0.0)), - to (shade (@bg_color, 0.9))) 1; - border-image-width: 1px 0; -} - -.notebook tab.bottom { - border-image: -gtk-gradient (linear, left bottom, left top, - from (alpha (shade (@bg_color, 0.9), 0.0)), - to (shade (@bg_color, 0.9))) 1; - border-image-width: 0 1px; -} - /* Draw a focus ring around labels in tabs */ .notebook tab GtkLabel { border: 1px solid transparent; From a3fbd1e33cef9e3dcef48b33b96025f6f5779d5b Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 10 Dec 2016 00:47:11 +0100 Subject: [PATCH 07/18] Fix all the themes where titlebars had borders, or white backgrounds --- terminatorlib/terminator.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 0ee0a8be..16b47509 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -394,6 +394,16 @@ class Terminator(Borg): .terminator-terminal-searchbar { background-color: @theme_bg_color; } """ + + # Fix several themes that put a borders, corners, or backgrounds around + # viewports, making the titlebar look bad. + css += """ + GtkViewport { + border-width: 0px; + border-radius: 0px; + background-color: transparent; } + """ + style_provider = Gtk.CssProvider() style_provider.load_from_data(css) self.style_providers.append(style_provider) From 8878aef3d2c84e6ff6d5d06a077aa5113327d0ba Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 10 Dec 2016 15:14:06 +0100 Subject: [PATCH 08/18] Change the selectors to target terminal window only, fixing the prefs window --- terminatorlib/terminator.py | 10 +-- .../Ambiance/gtk-3.0/apps/terminator.css | 46 +++++----- .../Radiance/gtk-3.0/apps/terminator.css | 89 +++++++++++++++++++ 3 files changed, 117 insertions(+), 28 deletions(-) create mode 100644 terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 16b47509..44fc6940 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -385,20 +385,20 @@ class Terminator(Borg): .terminator-terminal-window { background-color: alpha(@theme_bg_color,0); } - .notebook.header { + .terminator-terminal-window .notebook.header { background-color: @theme_bg_color; } - .pane-separator { + .terminator-terminal-window .pane-separator { background-color: @theme_bg_color; } - .terminator-terminal-searchbar { + .terminator-terminal-window .terminator-terminal-searchbar { background-color: @theme_bg_color; } """ # Fix several themes that put a borders, corners, or backgrounds around # viewports, making the titlebar look bad. css += """ - GtkViewport { + .terminator-terminal-window GtkViewport { border-width: 0px; border-radius: 0px; background-color: transparent; } @@ -430,7 +430,7 @@ class Terminator(Borg): # Size the GtkPaned splitter handle size. if self.config['handle_size'] in xrange(0, 21): css = """ - GtkPaned { + .terminator-terminal-window GtkPaned { -GtkPaned-handle-size: %s; } """ % self.config['handle_size'] style_provider = Gtk.CssProvider() diff --git a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css index 5bbe9b04..4d46e124 100644 --- a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css +++ b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css @@ -5,7 +5,7 @@ Might want to have a seperate option for "shrinking" the tabs, by nuking the padding/borders in the tabs. */ -.notebook.header { +.terminator-terminal-window .notebook.header { border-width: 0; /* set below depending on position of tab bar */ border-color: shade (@bg_color, 0.82); border-style: solid; @@ -14,19 +14,19 @@ nuking the padding/borders in the tabs. } /* Draw a border between tabs and content ... */ -.notebook.header.top { border-bottom-width: 1px; } -.notebook.header.right { border-left-width: 1px; } -.notebook.header.left { border-right-width: 1px; } -.notebook.header.bottom { border-top-width: 1px; } +.terminator-terminal-window .notebook.header.top { border-bottom-width: 1px; } +.terminator-terminal-window .notebook.header.right { border-left-width: 1px; } +.terminator-terminal-window .notebook.header.left { border-right-width: 1px; } +.terminator-terminal-window .notebook.header.bottom { border-top-width: 1px; } /* ... unless the content is in a frame (thus having a border itself */ -.notebook.header.frame.top { border: none; } -.notebook.header.frame.right { border: none; } -.notebook.header.frame.right { border: none; } -.notebook.header.frame.bottom { border: none; } +.terminator-terminal-window .notebook.header.frame.top { border: none; } +.terminator-terminal-window .notebook.header.frame.right { border: none; } +.terminator-terminal-window .notebook.header.frame.right { border: none; } +.terminator-terminal-window .notebook.header.frame.bottom { border: none; } -.notebook tab { +.terminator-terminal-window .notebook tab { background-color: shade(@bg_color, 0.7); border-image: none; border-style: solid; @@ -34,56 +34,56 @@ nuking the padding/borders in the tabs. } /* give active tab a background, as it might be dragged across of others when reordering */ -.notebook tab:active { +.terminator-terminal-window .notebook tab:active { background-color: @bg_color; } -.notebook tab.top:active { padding-bottom: 3px; } -.notebook tab.bottom:active { padding-top: 3px; } -.notebook tab.left:active { padding-right: 5px; } -.notebook tab.right:active { padding-left: 5px; } +.terminator-terminal-window .notebook tab.top:active { padding-bottom: 3px; } +.terminator-terminal-window .notebook tab.bottom:active { padding-top: 3px; } +.terminator-terminal-window .notebook tab.left:active { padding-right: 5px; } +.terminator-terminal-window .notebook tab.right:active { padding-left: 5px; } -.notebook tab.top { +.terminator-terminal-window .notebook tab.top { padding: 4px 6px 2px 6px; border-width: 1px 1px 0px 1px; border-radius: 8px 8px 0px 0px; } -.notebook tab.bottom { +.terminator-terminal-window .notebook tab.bottom { padding: 2px 6px 4px 6px; border-width: 0px 1px 1px 1px; border-radius: 0px 0px 8px 8px; } -.notebook tab.left { +.terminator-terminal-window .notebook tab.left { padding: 2px 4px 2px 6px; border-width: 1px 0px 1px 1px; border-radius: 8px 0px 0px 8px; } -.notebook tab.right { +.terminator-terminal-window .notebook tab.right { padding: 2px 6px 2px 4px; border-width: 1px 1px 1px 0px; border-radius: 0px 8px 8px 0px; } -.notebook tab .button { +.terminator-terminal-window .notebook tab .button { background-color: transparent; padding: 1px; } /* Draw a focus ring around labels in tabs */ -.notebook tab GtkLabel { +.terminator-terminal-window .notebook tab GtkLabel { border: 1px solid transparent; border-radius: 5px; } -.notebook:focus tab GtkLabel.active-page { +.terminator-terminal-window .notebook:focus tab GtkLabel.active-page { border-color: @focus_color; background-color: @focus_bg_color; } -.notebook GtkDrawingArea { +.terminator-terminal-window .notebook GtkDrawingArea { background-color: shade (@bg_color, 1.02); } diff --git a/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css new file mode 100644 index 00000000..4d46e124 --- /dev/null +++ b/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css @@ -0,0 +1,89 @@ +/* +Some basic playing copying out the GNOME-Terminal style tab headers. + +Might want to have a seperate option for "shrinking" the tabs, by +nuking the padding/borders in the tabs. +*/ + +.terminator-terminal-window .notebook.header { + border-width: 0; /* set below depending on position of tab bar */ + border-color: shade (@bg_color, 0.82); + border-style: solid; + border-radius: 0px 0px 0px 0px; + background-color: @dark_bg_color; +} + +/* Draw a border between tabs and content ... */ +.terminator-terminal-window .notebook.header.top { border-bottom-width: 1px; } +.terminator-terminal-window .notebook.header.right { border-left-width: 1px; } +.terminator-terminal-window .notebook.header.left { border-right-width: 1px; } +.terminator-terminal-window .notebook.header.bottom { border-top-width: 1px; } + +/* ... unless the content is in a frame (thus having a border itself */ +.terminator-terminal-window .notebook.header.frame.top { border: none; } +.terminator-terminal-window .notebook.header.frame.right { border: none; } +.terminator-terminal-window .notebook.header.frame.right { border: none; } +.terminator-terminal-window .notebook.header.frame.bottom { border: none; } + + +.terminator-terminal-window .notebook tab { + background-color: shade(@bg_color, 0.7); + border-image: none; + border-style: solid; + border-color: @dark_bg_color; +} + +/* give active tab a background, as it might be dragged across of others when reordering */ +.terminator-terminal-window .notebook tab:active { + background-color: @bg_color; +} + +.terminator-terminal-window .notebook tab.top:active { padding-bottom: 3px; } +.terminator-terminal-window .notebook tab.bottom:active { padding-top: 3px; } +.terminator-terminal-window .notebook tab.left:active { padding-right: 5px; } +.terminator-terminal-window .notebook tab.right:active { padding-left: 5px; } + +.terminator-terminal-window .notebook tab.top { + padding: 4px 6px 2px 6px; + border-width: 1px 1px 0px 1px; + border-radius: 8px 8px 0px 0px; +} + +.terminator-terminal-window .notebook tab.bottom { + padding: 2px 6px 4px 6px; + border-width: 0px 1px 1px 1px; + border-radius: 0px 0px 8px 8px; +} + +.terminator-terminal-window .notebook tab.left { + padding: 2px 4px 2px 6px; + border-width: 1px 0px 1px 1px; + border-radius: 8px 0px 0px 8px; +} + +.terminator-terminal-window .notebook tab.right { + padding: 2px 6px 2px 4px; + border-width: 1px 1px 1px 0px; + border-radius: 0px 8px 8px 0px; +} + +.terminator-terminal-window .notebook tab .button { + background-color: transparent; + padding: 1px; +} + +/* Draw a focus ring around labels in tabs */ +.terminator-terminal-window .notebook tab GtkLabel { + border: 1px solid transparent; + border-radius: 5px; +} + +.terminator-terminal-window .notebook:focus tab GtkLabel.active-page { + border-color: @focus_color; + background-color: @focus_bg_color; +} + +.terminator-terminal-window .notebook GtkDrawingArea { + background-color: shade (@bg_color, 1.02); +} + From fe64fc6b1d2060788d9c5dee77859a68adc75555 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 10 Dec 2016 15:41:51 +0100 Subject: [PATCH 09/18] I'll be amazed if anyone actually uses it, but a quick fixup for the ancient Raleigh --- .../themes/Raleigh/gtk-3.0/apps/terminator.css | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 terminatorlib/themes/Raleigh/gtk-3.0/apps/terminator.css diff --git a/terminatorlib/themes/Raleigh/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Raleigh/gtk-3.0/apps/terminator.css new file mode 100644 index 00000000..24f86de1 --- /dev/null +++ b/terminatorlib/themes/Raleigh/gtk-3.0/apps/terminator.css @@ -0,0 +1,15 @@ +.terminator-terminal-window { + background-color: alpha(@bg_color,0); } + +.terminator-terminal-window .notebook { + background-color: @bg_color; } + +.terminator-terminal-window .notebook.header { + background-color: @bg_color; } + +.terminator-terminal-window .pane-separator { + background-color: @bg_color; } + +.terminator-terminal-window .terminator-terminal-searchbar { + background-color: @bg_color; } + From f03cdd007f9a9f1a899318710cf1d5f98871b80e Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 10 Dec 2016 16:35:25 +0100 Subject: [PATCH 10/18] A little more organization, separating into theme fixes that must be applied to correct rendering, and theme styling changes that may or may not be desired. Still needs config option. --- terminatorlib/terminator.py | 26 +++++++++++-------- .../Adwaita/gtk-3.0/apps/terminator.css | 3 ++- ...{terminator.css => terminator_styling.css} | 0 ...{terminator.css => terminator_styling.css} | 0 .../Raleigh/gtk-3.0/apps/terminator.css | 1 + 5 files changed, 18 insertions(+), 12 deletions(-) rename terminatorlib/themes/Ambiance/gtk-3.0/apps/{terminator.css => terminator_styling.css} (100%) rename terminatorlib/themes/Radiance/gtk-3.0/apps/{terminator.css => terminator_styling.css} (100%) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 44fc6940..2fc045a3 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -415,17 +415,21 @@ class Terminator(Borg): settings=Gtk.Settings().get_default() theme_name = settings.get_property('gtk-theme_name') - for theme_dir in [usr_theme_dir, app_theme_dir]: - path_to_theme_specific_css = os.path.join(theme_dir, - 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 + + theme_part_list = ['terminator.css'] + if 1: # checkbox_style - needs adding to prefs + theme_part_list.append('terminator_styling.css') + for theme_part_file in theme_part_list: + for theme_dir in [usr_theme_dir, app_theme_dir]: + path_to_theme_specific_css = os.path.join(theme_dir, + theme_name, + 'gtk-3.0/apps', + theme_part_file) + if 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. if self.config['handle_size'] in xrange(0, 21): diff --git a/terminatorlib/themes/Adwaita/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Adwaita/gtk-3.0/apps/terminator.css index c47de344..faaf58ab 100644 --- a/terminatorlib/themes/Adwaita/gtk-3.0/apps/terminator.css +++ b/terminatorlib/themes/Adwaita/gtk-3.0/apps/terminator.css @@ -1,4 +1,5 @@ -GtkPaned { +/* Fixes oversized hover area preventing selecting characters. */ +.terminator-terminal-window GtkPaned { margin: 0 0 0 0; padding: 0 0 0 0; } diff --git a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator_styling.css similarity index 100% rename from terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css rename to terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator_styling.css diff --git a/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator_styling.css similarity index 100% rename from terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css rename to terminatorlib/themes/Radiance/gtk-3.0/apps/terminator_styling.css diff --git a/terminatorlib/themes/Raleigh/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Raleigh/gtk-3.0/apps/terminator.css index 24f86de1..880a541c 100644 --- a/terminatorlib/themes/Raleigh/gtk-3.0/apps/terminator.css +++ b/terminatorlib/themes/Raleigh/gtk-3.0/apps/terminator.css @@ -1,3 +1,4 @@ +/* Raleigh is so old, it doesn't use the correct public colours */ .terminator-terminal-window { background-color: alpha(@bg_color,0); } From f02f38389c8fd94136a3fafc22d7066b4ce652e2 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 11 Dec 2016 05:46:02 +0100 Subject: [PATCH 11/18] Fixes the transparent scrollbars for Ambiance. --- terminatorlib/terminal.py | 10 +++++++ terminatorlib/terminator.py | 28 ++++++++++++++++++- .../Ambiance/gtk-3.0/apps/terminator.css | 6 ++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 0ee4851d..fa8d7a1b 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -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())); diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 2fc045a3..a728c0a2 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -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) diff --git a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css new file mode 100644 index 00000000..36520d33 --- /dev/null +++ b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css @@ -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); +} + From 7d9347d3f085fcdf1473136f539a9af8a76f4e48 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 11 Dec 2016 06:03:46 +0100 Subject: [PATCH 12/18] Fix Radiance transparent scrollbars, and remove the oversized splitter area from Breeze --- terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css | 5 +++++ terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css create mode 100644 terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css diff --git a/terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css new file mode 100644 index 00000000..faaf58ab --- /dev/null +++ b/terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css @@ -0,0 +1,5 @@ +/* Fixes oversized hover area preventing selecting characters. */ +.terminator-terminal-window GtkPaned { + margin: 0 0 0 0; + padding: 0 0 0 0; } + diff --git a/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css new file mode 100644 index 00000000..36520d33 --- /dev/null +++ b/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css @@ -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); +} + From 4fcbabdab510f1f7ac7a2a31a070d0b333859bf8 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 11 Dec 2016 18:35:22 +0100 Subject: [PATCH 13/18] Add the scrollbar track highlighting in for Ambiance/Radiance --- terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css | 3 +++ terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css | 3 +++ 2 files changed, 6 insertions(+) diff --git a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css index 36520d33..8d9de724 100644 --- a/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css +++ b/terminatorlib/themes/Ambiance/gtk-3.0/apps/terminator.css @@ -4,3 +4,6 @@ background-color: alpha(@dark_bg_color,0); } +.terminator-terminal-window .scrollbar:hover:not(.slider) { + background-color: alpha(@scrollbar_track_color, 0.4); +} diff --git a/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css index 36520d33..8d9de724 100644 --- a/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css +++ b/terminatorlib/themes/Radiance/gtk-3.0/apps/terminator.css @@ -4,3 +4,6 @@ background-color: alpha(@dark_bg_color,0); } +.terminator-terminal-window .scrollbar:hover:not(.slider) { + background-color: alpha(@scrollbar_track_color, 0.4); +} From 117c5c8f0d1ac98186b20abcca4db43b34bb1281 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 11 Dec 2016 19:32:22 +0100 Subject: [PATCH 14/18] Fix the oversight of not clearing the css string if the handle size is -1, resulting in styling getting trashed by the previous declarations --- terminatorlib/terminator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index a728c0a2..4ad0055b 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -458,8 +458,9 @@ class Terminator(Borg): break # Size the GtkPaned splitter handle size. + css = "" if self.config['handle_size'] in xrange(0, 21): - css = """ + css += """ .terminator-terminal-window GtkPaned { -GtkPaned-handle-size: %s; } """ % self.config['handle_size'] From 4e78c447e48de398a0b30e2b33f1be7b7de8c5c4 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 11 Dec 2016 22:25:37 +0100 Subject: [PATCH 15/18] Fix the wrong background color for profiles using system colours --- terminatorlib/terminator.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 4ad0055b..731942c1 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -414,11 +414,19 @@ class Terminator(Borg): 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) + # Create a dummy window/vte and realise it so it has correct + # values to read from + tmp_win = Gtk.Window() + tmp_vte = Vte.Terminal() + tmp_win.add(tmp_vte) + tmp_win.realize() + bgcolor = tmp_vte.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)) + tmp_win.remove(tmp_vte) + del(tmp_vte) + del(tmp_win) else: bgcolor = Gdk.RGBA() bgcolor = profiles[profile]['background_color'] From 2186f93feeb813e78a531d039bae03ab22d41ed1 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 11 Dec 2016 23:50:42 +0100 Subject: [PATCH 16/18] Do a reconfigure when the gtk-theme-name property changes, avoiding issues with styled themes. --- terminatorlib/terminator.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 731942c1..2adcb863 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -60,6 +60,9 @@ class Terminator(Borg): groupsend = None groupsend_type = {'all':0, 'group':1, 'off':2} + cur_gtk_theme_name = None + gtk_settings = None + def __init__(self): """Class initialiser""" @@ -92,6 +95,13 @@ class Terminator(Borg): self.pid_cwd = get_pid_cwd() if self.gnome_client is None: self.attempt_gnome_client() + self.connect_signals() + + def connect_signals(self): + """Connect all the gtk signals""" + self.gtk_settings=Gtk.Settings().get_default() + self.gtk_settings.connect('notify::gtk-theme-name', self.on_gtk_theme_name_notify) + self.cur_gtk_theme_name = self.gtk_settings.get_property('gtk-theme-name') def set_origcwd(self, cwd): """Store the original cwd our process inherits""" @@ -370,6 +380,13 @@ class Terminator(Borg): if window.uuid == self.last_active_window: window.show() + def on_gtk_theme_name_notify(self, settings, prop): + """Reconfigure if the gtk theme name changes""" + new_gtk_theme_name = settings.get_property(prop.name) + if new_gtk_theme_name != self.cur_gtk_theme_name: + self.cur_gtk_theme_name = new_gtk_theme_name + self.reconfigure() + def reconfigure(self): """Update configuration for the whole application""" @@ -447,8 +464,7 @@ class Terminator(Borg): (head, _tail) = os.path.split(borg.__file__) app_theme_dir = os.path.join(head, 'themes') - settings=Gtk.Settings().get_default() - theme_name = settings.get_property('gtk-theme_name') + theme_name = self.gtk_settings.get_property('gtk-theme-name') theme_part_list = ['terminator.css'] if 1: # checkbox_style - needs adding to prefs From 0bd8af430472f9e7097b07f5eaf8d586b8d251c6 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 12 Dec 2016 12:27:56 +0100 Subject: [PATCH 17/18] Add the ability to deactivate extra theme dependant styling --- terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 122 ++++++++++++++++++-------------- terminatorlib/prefseditor.py | 8 +++ terminatorlib/terminator.py | 2 +- 4 files changed, 79 insertions(+), 54 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 813c56b3..2a6b254d 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -94,6 +94,7 @@ DEFAULTS = { 'geometry_hinting' : False, 'window_state' : 'normal', 'borderless' : False, + 'extra_styling' : True, 'tab_position' : 'top', 'broadcast_default' : 'group', 'close_button_on_tab' : True, diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 6a1533ad..159bb2d3 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -355,10 +355,8 @@ False - 6 + 5 Terminator Preferences - 640 - 400 normal @@ -849,6 +847,36 @@ False 6 12 + + + Window borders + False + True + True + False + 0.5 + True + True + + + + 0 + 3 + 3 + + + + + True + False + Unfocused terminal font brightness: + 0 + + + 0 + 2 + + True @@ -858,23 +886,7 @@ 0 - 0 - - - - - True - False - -1 - right - 5 - 5 - 1 - 1 - - - 1 - 0 + 1 @@ -893,34 +905,6 @@ 2 - 0 - - - - - True - False - Unfocused terminal font brightness: - 0 - - - 0 - 1 - - - - - True - False - 100% - right - 5 - 5 - 1 - 1 - - - 1 1 @@ -940,24 +924,56 @@ 2 + 2 + + + + + True + False + -1 + right + 5 + 5 + 1 + 1 + + + 1 1 - - Window borders + + True + False + 100% + right + 5 + 5 + 1 + 1 + + + 1 + 2 + + + + + Extra Styling (Theme dependant) False True True False - 0.5 + 0 True True - + 0 - 2 + 0 3 diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 736b17e7..85b5c60e 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -254,6 +254,9 @@ class PrefsEditor: # Window borders widget = guiget('winbordercheck') widget.set_active(not self.config['borderless']) + # Extra styling + widget = guiget('extrastylingcheck') + widget.set_active(self.config['extra_styling']) # Tab bar position option = self.config['tab_position'] widget = guiget('tabposcombo') @@ -692,6 +695,11 @@ class PrefsEditor: self.config['borderless'] = not widget.get_active() self.config.save() + def on_extrastylingcheck_toggled(self, widget): + """Extra styling setting changed""" + self.config['extra_styling'] = widget.get_active() + self.config.save() + def on_hidefromtaskbcheck_toggled(self, widget): """Hide from taskbar setting changed""" self.config['hide_from_taskbar'] = widget.get_active() diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 2adcb863..977d8603 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -467,7 +467,7 @@ class Terminator(Borg): theme_name = self.gtk_settings.get_property('gtk-theme-name') theme_part_list = ['terminator.css'] - if 1: # checkbox_style - needs adding to prefs + if self.config['extra_styling']: # checkbox_style - needs adding to prefs theme_part_list.append('terminator_styling.css') for theme_part_file in theme_part_list: for theme_dir in [usr_theme_dir, app_theme_dir]: From 91beabf869ec347db139f0d5ccdbedcdeb6b6add Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 12 Dec 2016 13:10:29 +0100 Subject: [PATCH 18/18] Some small fixes for transparent scrollbars in Breeze and HighContrast --- terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css | 7 +++++++ .../themes/HighContrast/gtk-3.0/apps/terminator.css | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 terminatorlib/themes/HighContrast/gtk-3.0/apps/terminator.css diff --git a/terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css b/terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css index faaf58ab..a5895563 100644 --- a/terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css +++ b/terminatorlib/themes/Breeze/gtk-3.0/apps/terminator.css @@ -3,3 +3,10 @@ margin: 0 0 0 0; padding: 0 0 0 0; } +/* First attempt at fixing the scrollbars */ +.terminator-terminal-window .scrollbar .trough, +.terminator-terminal-window .scrollbar .button { + background-color: @theme_bg_color; + border-radius: 0px +} + diff --git a/terminatorlib/themes/HighContrast/gtk-3.0/apps/terminator.css b/terminatorlib/themes/HighContrast/gtk-3.0/apps/terminator.css new file mode 100644 index 00000000..0736b8ca --- /dev/null +++ b/terminatorlib/themes/HighContrast/gtk-3.0/apps/terminator.css @@ -0,0 +1,6 @@ +/* First attempt to fix scrollbars being transparent */ + +.terminator-terminal-window .scrollbar .trough { + background-color: @theme_bg_color; +} +