Allow user configurability of the cursor shape. Patch from Jordan Callicoat. Closes LP #348244
This commit is contained in:
parent
44e958f53e
commit
711986766a
|
@ -87,6 +87,10 @@ Default value: \fBTrue\fR
|
||||||
Default colour of cursor, as a colour specification (can be HTML-style hex digits, or a colour name such as "red").
|
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
|
Default value: Current value of \fBforeground_color\fR
|
||||||
.TP
|
.TP
|
||||||
|
.B cursor_shape
|
||||||
|
Default shape of cursor. Possibilities are "block", "ibeam", and "underline".
|
||||||
|
Default value: \fBblock\fR
|
||||||
|
.TP
|
||||||
.B emulation
|
.B emulation
|
||||||
Sets what type of terminal should be emulated.
|
Sets what type of terminal should be emulated.
|
||||||
Default value: \fBxterm\fR
|
Default value: \fBxterm\fR
|
||||||
|
|
|
@ -71,6 +71,7 @@ Defaults = {
|
||||||
'backspace_binding' : 'ascii-del',
|
'backspace_binding' : 'ascii-del',
|
||||||
'delete_binding' : 'delete-sequence',
|
'delete_binding' : 'delete-sequence',
|
||||||
'cursor_blink' : True,
|
'cursor_blink' : True,
|
||||||
|
'cursor_shape' : 'block',
|
||||||
'cursor_color' : '',
|
'cursor_color' : '',
|
||||||
'emulation' : 'xterm',
|
'emulation' : 'xterm',
|
||||||
'font' : 'Mono 10',
|
'font' : 'Mono 10',
|
||||||
|
|
|
@ -8,7 +8,7 @@ import gtk, gobject
|
||||||
|
|
||||||
class ProfileEditor:
|
class ProfileEditor:
|
||||||
# lists of which settings to put in which tabs
|
# 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']
|
appearance = ['titlebars', 'titletips', 'allow_bold', 'audible_bell', 'visible_bell', 'urgent_bell', 'force_no_bell', 'background_darkness', 'background_type', 'background_image', 'cursor_blink', 'cursor_shape', 'font', 'scrollbar_position', 'scroll_background', 'use_system_font', 'use_theme_colors', 'enable_real_transparency']
|
||||||
colours = ['foreground_color','background_color', 'cursor_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']
|
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']
|
globals = ['fullscreen', 'maximise', 'borderless', 'handle_size', 'cycle_term_tab', 'close_button_on_tab', 'tab_position', 'copy_on_selection', 'extreme_tabs', 'try_posix_regexp']
|
||||||
|
@ -51,6 +51,7 @@ class ProfileEditor:
|
||||||
background_type = ['solid', 'image', 'transparent']
|
background_type = ['solid', 'image', 'transparent']
|
||||||
tab_position = ['top', 'bottom', 'left', 'right']
|
tab_position = ['top', 'bottom', 'left', 'right']
|
||||||
tab_position_gtk = {'top' : gtk.POS_TOP, 'bottom' : gtk.POS_BOTTOM, 'left' : gtk.POS_LEFT, 'right' : gtk.POS_RIGHT}
|
tab_position_gtk = {'top' : gtk.POS_TOP, 'bottom' : gtk.POS_BOTTOM, 'left' : gtk.POS_LEFT, 'right' : gtk.POS_RIGHT}
|
||||||
|
cursor_shape = ['block', 'ibeam', 'underline']
|
||||||
|
|
||||||
def __init__ (self, term):
|
def __init__ (self, term):
|
||||||
self.term = term
|
self.term = term
|
||||||
|
@ -201,6 +202,11 @@ class ProfileEditor:
|
||||||
for item in self.tab_position:
|
for item in self.tab_position:
|
||||||
widget.append_text (item)
|
widget.append_text (item)
|
||||||
widget.set_active (self.tab_position.index(value))
|
widget.set_active (self.tab_position.index(value))
|
||||||
|
elif key == 'cursor_shape':
|
||||||
|
widget = gtk.combo_box_new_text()
|
||||||
|
for item in self.cursor_shape:
|
||||||
|
widget.append_text (item)
|
||||||
|
widget.set_active (self.cursor_shape.index (value))
|
||||||
else:
|
else:
|
||||||
if type == "bool":
|
if type == "bool":
|
||||||
widget = gtk.CheckButton ()
|
widget = gtk.CheckButton ()
|
||||||
|
@ -248,6 +254,8 @@ class ProfileEditor:
|
||||||
bucket = self.background_type
|
bucket = self.background_type
|
||||||
elif widget.name == 'tab_position':
|
elif widget.name == 'tab_position':
|
||||||
bucket = self.tab_position
|
bucket = self.tab_position
|
||||||
|
elif widget.name == 'cursor_shape':
|
||||||
|
bucket = self.cursor_shape
|
||||||
else:
|
else:
|
||||||
err("Unknown bucket type for %s" % widget.name)
|
err("Unknown bucket type for %s" % widget.name)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -677,6 +677,9 @@ text/plain
|
||||||
if cursor_color != '':
|
if cursor_color != '':
|
||||||
self._vte.set_color_cursor (gtk.gdk.color_parse (cursor_color))
|
self._vte.set_color_cursor (gtk.gdk.color_parse (cursor_color))
|
||||||
|
|
||||||
|
# Set cursor shape
|
||||||
|
self._vte.set_cursor_shape (vte.__dict__["CURSOR_SHAPE_" + self.conf.cursor_shape.upper ()])
|
||||||
|
|
||||||
# Set our background image, transparency and type
|
# Set our background image, transparency and type
|
||||||
# Many thanks to the authors of gnome-terminal, on which this code is based.
|
# Many thanks to the authors of gnome-terminal, on which this code is based.
|
||||||
background_type = self.conf.background_type
|
background_type = self.conf.background_type
|
||||||
|
|
Loading…
Reference in New Issue