Added radio options to the Cursor colour to make it easier to go back to the XOR'd foreground colour
This commit is contained in:
parent
e6fe49820f
commit
f0330dadf3
|
@ -214,7 +214,8 @@ DEFAULTS = {
|
||||||
'color_scheme' : 'grey_on_black',
|
'color_scheme' : 'grey_on_black',
|
||||||
'cursor_blink' : True,
|
'cursor_blink' : True,
|
||||||
'cursor_shape' : 'block',
|
'cursor_shape' : 'block',
|
||||||
'cursor_color' : '#aaaaaa',
|
'cursor_color' : '',
|
||||||
|
'cursor_color_fg' : True,
|
||||||
'term' : 'xterm-256color',
|
'term' : 'xterm-256color',
|
||||||
'colorterm' : 'truecolor',
|
'colorterm' : 'truecolor',
|
||||||
'font' : 'Mono 10',
|
'font' : 'Mono 10',
|
||||||
|
|
|
@ -1808,24 +1808,70 @@
|
||||||
<object class="GtkHBox" id="hbox1">
|
<object class="GtkHBox" id="hbox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkColorButton" id="cursor_color">
|
<object class="GtkRadioButton" id="cursor_color_foreground_radiobutton">
|
||||||
|
<property name="label" translatable="yes">Foreground</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="active">True</property>
|
||||||
<property name="color">#000000000000</property>
|
<property name="draw_indicator">True</property>
|
||||||
<signal name="color-set" handler="on_cursor_color_color_set" swapped="no"/>
|
<signal name="toggled" handler="on_cursor_color_type_toggled" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkHBox" id="hbox4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="cursor_color_custom_radiobutton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<property name="group">cursor_color_foreground_radiobutton</property>
|
||||||
|
<signal name="toggled" handler="on_cursor_color_type_toggled" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkColorButton" id="cursor_color">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="color">#000000000000</property>
|
||||||
|
<signal name="color-set" handler="on_cursor_color_color_set" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
@ -450,13 +450,24 @@ class PrefsEditor:
|
||||||
# Cursor blink
|
# Cursor blink
|
||||||
widget = guiget('cursor_blink')
|
widget = guiget('cursor_blink')
|
||||||
widget.set_active(self.config['cursor_blink'])
|
widget.set_active(self.config['cursor_blink'])
|
||||||
# Cursor colour
|
# Cursor colour - Radio values
|
||||||
|
if self.config['cursor_color_fg']:
|
||||||
|
widget = guiget('cursor_color_foreground_radiobutton')
|
||||||
|
else:
|
||||||
|
widget = guiget('cursor_color_custom_radiobutton')
|
||||||
|
widget.set_active(True)
|
||||||
|
# Cursor colour - swatch
|
||||||
widget = guiget('cursor_color')
|
widget = guiget('cursor_color')
|
||||||
|
widget.set_sensitive(not self.config['cursor_color_fg'])
|
||||||
try:
|
try:
|
||||||
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
||||||
except ValueError:
|
except (ValueError, TypeError):
|
||||||
self.config['cursor_color'] = "#FFFFFF"
|
try:
|
||||||
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
self.config['cursor_color'] = self.config['foreground_color']
|
||||||
|
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
||||||
|
except ValueError:
|
||||||
|
self.config['cursor_color'] = "#FFFFFF"
|
||||||
|
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
||||||
|
|
||||||
## Command tab
|
## Command tab
|
||||||
# Login shell
|
# Login shell
|
||||||
|
@ -931,6 +942,26 @@ class PrefsEditor:
|
||||||
self.config['custom_command'] = widget.get_text()
|
self.config['custom_command'] = widget.get_text()
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
|
def on_cursor_color_type_toggled(self, widget):
|
||||||
|
guiget = self.builder.get_object
|
||||||
|
|
||||||
|
customwidget = guiget('cursor_color_custom_radiobutton')
|
||||||
|
colorwidget = guiget('cursor_color')
|
||||||
|
|
||||||
|
colorwidget.set_sensitive(customwidget.get_active())
|
||||||
|
self.config['cursor_color_fg'] = not customwidget.get_active()
|
||||||
|
|
||||||
|
try:
|
||||||
|
colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
try:
|
||||||
|
self.config['cursor_color'] = self.config['foreground_color']
|
||||||
|
colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
||||||
|
except ValueError:
|
||||||
|
self.config['cursor_color'] = "#FFFFFF"
|
||||||
|
colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
||||||
|
self.config.save()
|
||||||
|
|
||||||
def on_cursor_color_color_set(self, widget):
|
def on_cursor_color_color_set(self, widget):
|
||||||
"""Cursor colour changed"""
|
"""Cursor colour changed"""
|
||||||
self.config['cursor_color'] = color2hex(widget)
|
self.config['cursor_color'] = color2hex(widget)
|
||||||
|
|
|
@ -780,18 +780,13 @@ class Terminal(Gtk.VBox):
|
||||||
|
|
||||||
def set_cursor_color(self):
|
def set_cursor_color(self):
|
||||||
"""Set the cursor color appropriately"""
|
"""Set the cursor color appropriately"""
|
||||||
if self.config['cursor_color'] == self.config['foreground_color']:
|
if self.config['cursor_color_fg']:
|
||||||
try:
|
self.vte.set_color_cursor(None)
|
||||||
self.vte.set_color_cursor(None)
|
else:
|
||||||
except TypeError:
|
|
||||||
# FIXME: I think this is only necessary because of
|
|
||||||
# https://bugzilla.gnome.org/show_bug.cgi?id=614910
|
|
||||||
pass
|
|
||||||
elif self.config['cursor_color'] != '':
|
|
||||||
cursor_color = Gdk.RGBA()
|
cursor_color = Gdk.RGBA()
|
||||||
cursor_color.parse(self.config['cursor_color'])
|
cursor_color.parse(self.config['cursor_color'])
|
||||||
self.vte.set_color_cursor(cursor_color)
|
self.vte.set_color_cursor(cursor_color)
|
||||||
|
|
||||||
def get_window_title(self):
|
def get_window_title(self):
|
||||||
"""Return the window title"""
|
"""Return the window title"""
|
||||||
return(self.vte.get_window_title() or str(self.command))
|
return(self.vte.get_window_title() or str(self.command))
|
||||||
|
|
Loading…
Reference in New Issue