More work on conf docs
This commit is contained in:
parent
9dc9fb2012
commit
cdb1fc8602
@ -18,28 +18,10 @@ from .conf.utils import (
|
||||
)
|
||||
from .config_data import all_options
|
||||
from .constants import cache_dir, defconf
|
||||
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
||||
from .layout import all_layouts
|
||||
from .rgb import color_as_int, color_from_int
|
||||
from .utils import log_error
|
||||
|
||||
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)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
mod_map = {'CTRL': 'CONTROL', 'CMD': 'SUPER', '⌘': 'SUPER', '⌥': 'ALT', 'OPTION': 'ALT', 'KITTY_MOD': 'KITTY'}
|
||||
|
||||
@ -308,12 +290,6 @@ def to_layout_names(raw):
|
||||
return uniq(ans)
|
||||
|
||||
|
||||
def adjust_line_height(x):
|
||||
if x.endswith('%'):
|
||||
return float(x[:-1].strip()) / 100.0
|
||||
return int(x)
|
||||
|
||||
|
||||
def macos_titlebar_color(x):
|
||||
x = x.strip('"')
|
||||
if x == 'system':
|
||||
@ -323,13 +299,6 @@ def macos_titlebar_color(x):
|
||||
return (color_as_int(to_color(x)) << 8) | 2
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
def tab_separator(x):
|
||||
for q in '\'"':
|
||||
if x.startswith(q) and x.endswith(q):
|
||||
@ -368,13 +337,10 @@ url_style.map = dict(
|
||||
|
||||
type_map = {
|
||||
'allow_remote_control': to_bool,
|
||||
'adjust_line_height': adjust_line_height,
|
||||
'adjust_column_width': adjust_line_height,
|
||||
'scrollback_lines': positive_int,
|
||||
'scrollback_pager': to_cmdline,
|
||||
'open_url_with': to_cmdline,
|
||||
'focus_follows_mouse': to_bool,
|
||||
'cursor_shape': to_cursor_shape,
|
||||
'open_url_modifiers': to_modifiers,
|
||||
'rectangle_select_modifiers': to_modifiers,
|
||||
'repaint_delay': positive_int,
|
||||
@ -390,8 +356,6 @@ type_map = {
|
||||
'enable_audio_bell': to_bool,
|
||||
'click_interval': positive_float,
|
||||
'mouse_hide_wait': positive_float,
|
||||
'cursor_blink_interval': positive_float,
|
||||
'cursor_stop_blinking_after': positive_float,
|
||||
'enabled_layouts': to_layout_names,
|
||||
'remember_window_size': to_bool,
|
||||
'initial_window_width': window_size,
|
||||
@ -400,7 +364,6 @@ type_map = {
|
||||
'macos_hide_from_tasks': to_bool,
|
||||
'macos_option_as_alt': to_bool,
|
||||
'macos_titlebar_color': macos_titlebar_color,
|
||||
'box_drawing_scale': box_drawing_scale,
|
||||
'dynamic_background_opacity': to_bool,
|
||||
'background_opacity': unit_float,
|
||||
'dim_opacity': unit_float,
|
||||
@ -421,7 +384,7 @@ type_map = {
|
||||
}
|
||||
|
||||
for name in (
|
||||
'foreground background cursor active_border_color inactive_border_color'
|
||||
'foreground background active_border_color inactive_border_color'
|
||||
' selection_foreground selection_background url_color bell_border_color'
|
||||
).split():
|
||||
type_map[name] = to_color
|
||||
|
||||
@ -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)
|
||||
|
||||
# }}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user