From 44e958f53e98a0a1c7082d7eb6d9413dc6cf2125 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 25 Mar 2009 12:48:27 +0000 Subject: [PATCH] Allow user configurability of the cursor colour. Patch from Jordan Callicoat. Closes LP #348231 --- doc/terminator_config.5 | 4 ++++ terminatorlib/config.py | 1 + terminatorlib/prefs_profile.py | 6 +++++- terminatorlib/terminatorterm.py | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index f59d8eb8..373df105 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -83,6 +83,10 @@ Default value: \fBescape\-sequence\fR Controls if the cursor blinks. Default value: \fBTrue\fR .TP +.B cursor_color +Default colour of cursor, as a colour specification (can be HTML-style hex digits, or a colour name such as "red"). +Default value: Current value of \fBforeground_color\fR +.TP .B emulation Sets what type of terminal should be emulated. Default value: \fBxterm\fR diff --git a/terminatorlib/config.py b/terminatorlib/config.py index df82d859..5712e7bd 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -71,6 +71,7 @@ Defaults = { 'backspace_binding' : 'ascii-del', 'delete_binding' : 'delete-sequence', 'cursor_blink' : True, + 'cursor_color' : '', 'emulation' : 'xterm', 'font' : 'Mono 10', 'foreground_color' : '#AAAAAA', diff --git a/terminatorlib/prefs_profile.py b/terminatorlib/prefs_profile.py index fe26e30a..21771733 100644 --- a/terminatorlib/prefs_profile.py +++ b/terminatorlib/prefs_profile.py @@ -9,7 +9,7 @@ import gtk, gobject class ProfileEditor: # lists of which settings to put in which tabs appearance = ['titlebars', 'titletips', 'allow_bold', 'audible_bell', 'visible_bell', 'urgent_bell', 'force_no_bell', 'background_darkness', 'background_type', 'background_image', 'cursor_blink', 'font', 'scrollbar_position', 'scroll_background', 'use_system_font', 'use_theme_colors', 'enable_real_transparency'] - colours = ['foreground_color','background_color', 'palette'] + colours = ['foreground_color','background_color', 'cursor_color', 'palette'] behaviour = ['backspace_binding', 'delete_binding', 'emulation', 'scroll_on_keystroke', 'scroll_on_output', 'scrollback_lines', 'focus', 'focus_on_close', 'exit_action', 'word_chars', 'mouse_autohide', 'use_custom_command', 'custom_command', 'http_proxy', 'encoding'] globals = ['fullscreen', 'maximise', 'borderless', 'handle_size', 'cycle_term_tab', 'close_button_on_tab', 'tab_position', 'copy_on_selection', 'extreme_tabs', 'try_posix_regexp'] @@ -172,6 +172,10 @@ class ProfileEditor: widget = gtk.ColorButton (gtk.gdk.color_parse (value)) elif key == 'background_color': widget = gtk.ColorButton (gtk.gdk.color_parse (value)) + elif key == 'cursor_color': + if not value: + value = self.source_get_value ('foreground_color') + widget = gtk.ColorButton (gtk.gdk.color_parse (value)) elif key == 'palette': colours = value.split (':') numcolours = len (colours) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index c8dc9153..01b3d7af 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -673,6 +673,10 @@ text/plain palette.append (gtk.gdk.color_parse (color)) self._vte.set_colors (fg_color, bg_color, palette) + cursor_color = self.conf.cursor_color + if cursor_color != '': + self._vte.set_color_cursor (gtk.gdk.color_parse (cursor_color)) + # Set our background image, transparency and type # Many thanks to the authors of gnome-terminal, on which this code is based. background_type = self.conf.background_type