mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-15 04:54:14 +02:00
More work on conf docs
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
from gettext import gettext as _
|
||||
|
||||
from .conf.definition import option_func
|
||||
from .conf.utils import positive_float, to_color
|
||||
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
||||
|
||||
MINIMUM_FONT_SIZE = 4
|
||||
|
||||
@@ -14,14 +16,50 @@ def to_font_size(x):
|
||||
return max(MINIMUM_FONT_SIZE, float(x))
|
||||
|
||||
|
||||
def adjust_line_height(x):
|
||||
if x.endswith('%'):
|
||||
return float(x[:-1].strip()) / 100.0
|
||||
return int(x)
|
||||
|
||||
|
||||
def box_drawing_scale(x):
|
||||
ans = tuple(float(x.strip()) for x in x.split(','))
|
||||
if len(ans) != 4:
|
||||
raise ValueError('Invalid box_drawing scale, must have four entries')
|
||||
return ans
|
||||
|
||||
|
||||
cshapes = {
|
||||
'block': CURSOR_BLOCK,
|
||||
'beam': CURSOR_BEAM,
|
||||
'underline': CURSOR_UNDERLINE
|
||||
}
|
||||
|
||||
|
||||
def to_cursor_shape(x):
|
||||
try:
|
||||
return cshapes[x.lower()]
|
||||
except KeyError:
|
||||
raise ValueError(
|
||||
'Invalid cursor shape: {} allowed values are {}'.format(
|
||||
x, ', '.join(cshapes)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
all_options = {}
|
||||
|
||||
|
||||
o, g, all_groups = option_func(all_options, {
|
||||
'fonts': [
|
||||
_('Fonts'),
|
||||
_('kitty has very powerful font management. You can configure individual\n'
|
||||
'font faces and even specify special fonts for particular characters.')
|
||||
],
|
||||
|
||||
'cursor': [
|
||||
_('Cursor customization'),
|
||||
],
|
||||
})
|
||||
type_map = {o.name: o.option_type for o in all_options.values()}
|
||||
|
||||
@@ -50,6 +88,15 @@ o('bold_italic_font', 'auto')
|
||||
|
||||
o('font_size', 11.0, _('Font size (in pts)'), option_type=to_font_size)
|
||||
|
||||
o('adjust_line_height', 0, _('Adjust cell dimensions'), option_type=adjust_line_height, long_text=_('''
|
||||
Change the size of each character cell kitty renders. You can use either numbers,
|
||||
which are interpreted as pixels or percentages (number followed by %), which
|
||||
are interpreted as percentages of the unmodified values. You can use negative
|
||||
pixels or percentages less than 100% to reduce sizes (but this might cause
|
||||
rendering artifacts).'''))
|
||||
o('adjust_column_width', 0, option_type=adjust_line_height)
|
||||
|
||||
|
||||
o(
|
||||
'+symbol_map',
|
||||
'U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols',
|
||||
@@ -66,4 +113,32 @@ Syntax is::
|
||||
symbol_map codepoints Font Family Name
|
||||
|
||||
'''))
|
||||
|
||||
o(
|
||||
'box_drawing_scale',
|
||||
'0.001, 1, 1.5, 2',
|
||||
_('Box drawing line thickness'),
|
||||
option_type=box_drawing_scale,
|
||||
long_text=_('''
|
||||
Change the sizes of the lines used for the box drawing unicode characters
|
||||
These values are in pts. They will be scaled by the monitor DPI to arrive at
|
||||
a pixel value. There must be four values corresponding to thin, normal, thick,
|
||||
and very thick lines.
|
||||
'''))
|
||||
|
||||
# }}}
|
||||
|
||||
g('cursor') # {{{
|
||||
|
||||
o('cursor', '#cccccc', _('Cursor color'), option_type=to_color)
|
||||
o('cursor_shape', 'block', _('Cursor shape'), option_type=to_cursor_shape, long_text=_(
|
||||
'The cursor shape can be one of (block, beam, underline)'))
|
||||
o('cursor_blink_interval', 0.5, _('Cursor blink'), option_type=positive_float, long_text=_('''
|
||||
The interval (in seconds) at which to blink the cursor. Set to zero to disable
|
||||
blinking. Note that numbers smaller than :conf:`repaint_delay` will be limited
|
||||
to :conf:`repaint_delay`. Stop blinking cursor after the specified number of
|
||||
seconds of keyboard inactivity. Set to zero to never stop blinking.
|
||||
'''))
|
||||
o('cursor_stop_blinking_after', 15.0, option_type=positive_float)
|
||||
|
||||
# }}}
|
||||
|
||||
Reference in New Issue
Block a user