From ee823a9cc9faca0af9011ab0c20acc0eeada8b65 Mon Sep 17 00:00:00 2001 From: Vulcalien Date: Sat, 14 Aug 2021 15:14:02 +0200 Subject: [PATCH] Custom foreground color for cursor (GUI not implemented yet) --- terminatorlib/config.py | 6 +++--- terminatorlib/terminal.py | 14 ++++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 1e368ff7..7c24f59e 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -215,8 +215,9 @@ DEFAULTS = { 'color_scheme' : 'grey_on_black', 'cursor_blink' : True, 'cursor_shape' : 'block', - 'cursor_color' : '', - 'cursor_color_fg' : True, + 'cursor_fg_color' : '#000000', + 'cursor_bg_color' : '#ffffff', + 'cursor_color_default' : True, 'term' : 'xterm-256color', 'colorterm' : 'truecolor', 'font' : 'Mono 10', @@ -844,4 +845,3 @@ class ConfigBase(Borg): def set_layout(self, layout, tree): """Set a layout""" self.layouts[layout] = tree - diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 0226cc1b..d2cca46a 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -837,12 +837,18 @@ class Terminal(Gtk.VBox): def set_cursor_color(self): """Set the cursor color appropriately""" - if self.config['cursor_color_fg']: + if self.config['cursor_color_default']: self.vte.set_color_cursor(None) + self.vte.set_color_cursor_foreground(None) else: - cursor_color = Gdk.RGBA() - cursor_color.parse(self.config['cursor_color']) - self.vte.set_color_cursor(cursor_color) + # foreground + cursor_fg_color = Gdk.RGBA() + cursor_fg_color.parse(self.config['cursor_fg_color']) + self.vte.set_color_cursor_foreground(cursor_fg_color) + # background + cursor_bg_color = Gdk.RGBA() + cursor_bg_color.parse(self.config['cursor_bg_color']) + self.vte.set_color_cursor(cursor_bg_color) def get_window_title(self): """Return the window title"""