More conf docs

This commit is contained in:
Kovid Goyal 2018-06-04 14:13:47 +05:30
parent 6c1434ab8a
commit c63c3d2844
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 43 additions and 16 deletions

View File

@ -14,11 +14,10 @@ from .conf.definition import as_conf_file
from .conf.utils import ( from .conf.utils import (
init_config, key_func, load_config as _load_config, merge_dicts, init_config, key_func, load_config as _load_config, merge_dicts,
parse_config_base, positive_int, python_string, to_bool, parse_config_base, positive_int, python_string, to_bool,
to_cmdline, to_color to_cmdline
) )
from .config_data import all_options from .config_data import all_options
from .constants import cache_dir, defconf from .constants import cache_dir, defconf
from .rgb import color_as_int
from .utils import log_error from .utils import log_error
from .config_data import to_modifiers, parse_mods from .config_data import to_modifiers, parse_mods
@ -247,15 +246,6 @@ def parse_send_text(val, key_definitions):
return parse_key(key_str, key_definitions) return parse_key(key_str, key_definitions)
def macos_titlebar_color(x):
x = x.strip('"')
if x == 'system':
return 0
if x == 'background':
return 1
return (color_as_int(to_color(x)) << 8) | 2
type_map = { type_map = {
'allow_remote_control': to_bool, 'allow_remote_control': to_bool,
'focus_follows_mouse': to_bool, 'focus_follows_mouse': to_bool,
@ -267,7 +257,6 @@ type_map = {
'macos_hide_titlebar': to_bool, 'macos_hide_titlebar': to_bool,
'macos_hide_from_tasks': to_bool, 'macos_hide_from_tasks': to_bool,
'macos_option_as_alt': to_bool, 'macos_option_as_alt': to_bool,
'macos_titlebar_color': macos_titlebar_color,
'dynamic_background_opacity': to_bool, 'dynamic_background_opacity': to_bool,
'window_alert_on_bell': to_bool, 'window_alert_on_bell': to_bool,
'bell_on_tab': to_bool, 'bell_on_tab': to_bool,
@ -275,9 +264,6 @@ type_map = {
'clear_all_shortcuts': to_bool, 'clear_all_shortcuts': to_bool,
} }
for i in range(256):
type_map['color{}'.format(i)] = to_color
def special_handling(key, val, ans): def special_handling(key, val, ans):
if key == 'map': if key == 'map':

View File

@ -12,7 +12,7 @@ from .conf.utils import (
) )
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
from .layout import all_layouts from .layout import all_layouts
from .rgb import color_as_sharp, color_from_int from .rgb import color_as_int, color_as_sharp, color_from_int
from .utils import log_error from .utils import log_error
# Utils {{{ # Utils {{{
@ -138,6 +138,7 @@ bright version. You can also set the remaining colors from the 256 color table
as color16 to color256.''') as color16 to color256.''')
], ],
'advanced': [_('Advanced')], 'advanced': [_('Advanced')],
'os': [_('OS specific tweaks')],
}) })
type_map = {o.name: o.option_type for o in all_options.values()} type_map = {o.name: o.option_type for o in all_options.values()}
# }}} # }}}
@ -527,4 +528,44 @@ many terminal programs, only change it if you know what you are doing, not
because you read some advice on Stack Overflow to change it. because you read some advice on Stack Overflow to change it.
''')) '''))
# }}}
g('os') # {{{
def macos_titlebar_color(x):
x = x.strip('"')
if x == 'system':
return 0
if x == 'background':
return 1
return (color_as_int(to_color(x)) << 8) | 2
o('macos_titlebar_color', 'system', option_type=macos_titlebar_color, long_text=_('''
Change the color of the kitty window's titlebar on macOS. A value of :code:`system`
means to use the default system color, a value of :code:`background` means to use
the background color of the currently active window and finally you can use
an arbitrary color, such as :code:`#12af59` or :code:`red`. WARNING: This option works by
using a hack, as there is no proper Cocoa API for it. It sets the background
color of the entire window and makes the titlebar transparent. As such it is
incompatible with :opt:`background_opacity`. If you want to use both, you are
probably better off just hiding the titlebar with :opt:`macos_hide_titlebar`.
'''))
o('macos_hide_titlebar', False, long_text=_('''
# Hide the kitty window's title bar on macOS.'''))
o('macos_option_as_alt', True, long_text=_('''
Use the option key as an alt key. With this set to no, kitty will use
the macOS native :kbd:`Option+Key` = unicode character behavior. This will
break any :kbd:`Alt+key` keyboard shortcuts in your terminal programs, but you
can use the macOS unicode input technique.
'''))
o('macos_hide_from_tasks', False, long_text=_('''
Hide the kitty window from running tasks (:kbd:`Option+Tab`) on macOS.
'''))
# }}} # }}}