Add cell width configuration in preferences
Currently, we have a setting for changing the line height (cell height), but not for changing cell width (both available in VTE). Depending on the font used, it is useful to have the ability to set a little more space between characters. This commit adds a configuration similar to the existing one for line height, but for character space (cell width scale [1]). Thanks Matt Rose for helping and encouraging me to implement this. 1. https://lazka.github.io/pgi-docs/Vte-2.91/classes/Terminal.html#Vte.Terminal.set_cell_width_scale
This commit is contained in:
parent
62716872df
commit
ef1768505c
|
@ -114,6 +114,7 @@ DEFAULTS = {
|
||||||
'smart_copy' : True,
|
'smart_copy' : True,
|
||||||
'clear_select_on_copy' : False,
|
'clear_select_on_copy' : False,
|
||||||
'line_height' : 1.0,
|
'line_height' : 1.0,
|
||||||
|
'cell_width' : 1.0,
|
||||||
'case_sensitive' : True,
|
'case_sensitive' : True,
|
||||||
'invert_search' : False,
|
'invert_search' : False,
|
||||||
'link_single_click' : False,
|
'link_single_click' : False,
|
||||||
|
@ -245,6 +246,7 @@ DEFAULTS = {
|
||||||
'use_theme_colors' : False,
|
'use_theme_colors' : False,
|
||||||
'bold_is_bright' : False,
|
'bold_is_bright' : False,
|
||||||
'line_height' : 1.0,
|
'line_height' : 1.0,
|
||||||
|
'cell_width' : 1.0,
|
||||||
'focus_on_close' : 'auto',
|
'focus_on_close' : 'auto',
|
||||||
'force_no_bell' : False,
|
'force_no_bell' : False,
|
||||||
'cycle_term_tab' : True,
|
'cycle_term_tab' : True,
|
||||||
|
|
|
@ -347,6 +347,13 @@
|
||||||
<property name="step-increment">0.10</property>
|
<property name="step-increment">0.10</property>
|
||||||
<property name="page-increment">0.20</property>
|
<property name="page-increment">0.20</property>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="adjustment_cellwidth">
|
||||||
|
<property name="lower">1</property>
|
||||||
|
<property name="upper">2</property>
|
||||||
|
<property name="value">1</property>
|
||||||
|
<property name="step-increment">0.10</property>
|
||||||
|
<property name="page-increment">0.20</property>
|
||||||
|
</object>
|
||||||
<object class="GtkAdjustment" id="background_darkness_scale">
|
<object class="GtkAdjustment" id="background_darkness_scale">
|
||||||
<property name="upper">1</property>
|
<property name="upper">1</property>
|
||||||
<property name="step-increment">0.10</property>
|
<property name="step-increment">0.10</property>
|
||||||
|
@ -880,7 +887,7 @@
|
||||||
<property name="spacing">36</property>
|
<property name="spacing">36</property>
|
||||||
<property name="homogeneous">True</property>
|
<property name="homogeneous">True</property>
|
||||||
<child>
|
<child>
|
||||||
<!-- n-columns=3 n-rows=5 -->
|
<!-- n-columns=3 n-rows=6 -->
|
||||||
<object class="GtkGrid" id="grid3">
|
<object class="GtkGrid" id="grid3">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
|
@ -992,6 +999,71 @@
|
||||||
<property name="top-attach">4</property>
|
<property name="top-attach">4</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScale" id="handlewidth">
|
||||||
|
<property name="width-request">100</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="halign">baseline</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="adjustment">adjustment1</property>
|
||||||
|
<property name="round-digits">0</property>
|
||||||
|
<property name="digits">0</property>
|
||||||
|
<property name="draw-value">False</property>
|
||||||
|
<property name="value-pos">bottom</property>
|
||||||
|
<signal name="value-changed" handler="on_handlewidth_value_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="cell_width_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Cell Width:</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScale" id="cellwidth">
|
||||||
|
<property name="width-request">100</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="halign">baseline</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="adjustment">adjustment_cellwidth</property>
|
||||||
|
<property name="round-digits">1</property>
|
||||||
|
<property name="draw-value">False</property>
|
||||||
|
<property name="value-pos">bottom</property>
|
||||||
|
<signal name="value-changed" handler="on_handlewidth_value_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="cellwidth_value_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label">1.0</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
<property name="width-chars">5</property>
|
||||||
|
<property name="max-width-chars">5</property>
|
||||||
|
<property name="lines">1</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScale" id="inactive_color_offset">
|
<object class="GtkScale" id="inactive_color_offset">
|
||||||
<property name="width-request">100</property>
|
<property name="width-request">100</property>
|
||||||
|
|
|
@ -263,6 +263,17 @@ class PrefsEditor:
|
||||||
widget.set_value(lineheightsize)
|
widget.set_value(lineheightsize)
|
||||||
widget = guiget('lineheight_value_label')
|
widget = guiget('lineheight_value_label')
|
||||||
widget.set_text(str(lineheightsize))
|
widget.set_text(str(lineheightsize))
|
||||||
|
|
||||||
|
#
|
||||||
|
# Cell Width
|
||||||
|
#
|
||||||
|
cellwidthsize = self.config['cell_width']
|
||||||
|
cellwidthsize = round(float(cellwidthsize),1)
|
||||||
|
widget = guiget('cellwidth')
|
||||||
|
widget.set_value(cellwidthsize)
|
||||||
|
widget = guiget('cellwidth_value_label')
|
||||||
|
widget.set_text(str(cellwidthsize))
|
||||||
|
|
||||||
# Window geometry hints
|
# Window geometry hints
|
||||||
geomhint = self.config['geometry_hinting']
|
geomhint = self.config['geometry_hinting']
|
||||||
widget = guiget('wingeomcheck')
|
widget = guiget('wingeomcheck')
|
||||||
|
@ -1264,6 +1275,18 @@ class PrefsEditor:
|
||||||
label_widget = guiget('lineheight_value_label')
|
label_widget = guiget('lineheight_value_label')
|
||||||
label_widget.set_text(str(value))
|
label_widget.set_text(str(value))
|
||||||
|
|
||||||
|
def on_handlewidth_value_changed(self, widget):
|
||||||
|
"""Handles cell width changed"""
|
||||||
|
value = widget.get_value()
|
||||||
|
value = round(float(value), 1)
|
||||||
|
if value > 2.0:
|
||||||
|
value = 2.0
|
||||||
|
self.config['cell_width'] = value
|
||||||
|
self.config.save()
|
||||||
|
guiget = self.builder.get_object
|
||||||
|
label_widget = guiget('cellwidth_value_label')
|
||||||
|
label_widget.set_text(str(value))
|
||||||
|
|
||||||
def on_focuscombo_changed(self, widget):
|
def on_focuscombo_changed(self, widget):
|
||||||
"""Focus type changed"""
|
"""Focus type changed"""
|
||||||
selected = widget.get_active()
|
selected = widget.get_active()
|
||||||
|
|
|
@ -718,6 +718,8 @@ class Terminal(Gtk.VBox):
|
||||||
self.vte.set_allow_bold(self.config['allow_bold'])
|
self.vte.set_allow_bold(self.config['allow_bold'])
|
||||||
if hasattr(self.vte,'set_cell_height_scale'):
|
if hasattr(self.vte,'set_cell_height_scale'):
|
||||||
self.vte.set_cell_height_scale(self.config['line_height'])
|
self.vte.set_cell_height_scale(self.config['line_height'])
|
||||||
|
if hasattr(self.vte,'set_cell_width_scale'):
|
||||||
|
self.vte.set_cell_width_scale(self.config['cell_width'])
|
||||||
if hasattr(self.vte, 'set_bold_is_bright'):
|
if hasattr(self.vte, 'set_bold_is_bright'):
|
||||||
self.vte.set_bold_is_bright(self.config['bold_is_bright'])
|
self.vte.set_bold_is_bright(self.config['bold_is_bright'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue