diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 7caf9f9b5..99a292046 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -2656,7 +2656,7 @@ with the mouse or the :doc:`hints kitten `. The special value of ''' ) -opt('shell_integration', 'enabled', +opt('shell_integration', 'enabled', option_type='shell_integration', long_text=''' Enable shell integration on supported shells. This enables features such as jumping to previous prompts, browsing the output of the previous command in a diff --git a/kitty/options/parse.py b/kitty/options/parse.py index 8bf2b6176..bdda3f069 100644 --- a/kitty/options/parse.py +++ b/kitty/options/parse.py @@ -12,8 +12,8 @@ from kitty.options.utils import ( deprecated_hide_window_decorations_aliases, deprecated_macos_show_window_title_in_menubar_alias, deprecated_send_text, disable_ligatures, edge_width, env, font_features, hide_window_decorations, macos_option_as_alt, macos_titlebar_color, optional_edge_width, parse_map, parse_mouse_map, - resize_draw_strategy, scrollback_lines, scrollback_pager_history_size, symbol_map, - tab_activity_symbol, tab_bar_edge, tab_bar_margin_height, tab_bar_min_tabs, tab_fade, + resize_draw_strategy, scrollback_lines, scrollback_pager_history_size, shell_integration, + symbol_map, tab_activity_symbol, tab_bar_edge, tab_bar_margin_height, tab_bar_min_tabs, tab_fade, tab_font_style, tab_separator, tab_title_template, to_cursor_shape, to_font_size, to_layout_names, to_modifiers, url_prefixes, url_style, visual_window_select_characters, watcher, window_border_width, window_size @@ -1147,7 +1147,7 @@ class Parser: ans['shell'] = str(val) def shell_integration(self, val: str, ans: typing.Dict[str, typing.Any]) -> None: - ans['shell_integration'] = str(val) + ans['shell_integration'] = shell_integration(val) def single_window_margin_width(self, val: str, ans: typing.Dict[str, typing.Any]) -> None: ans['single_window_margin_width'] = optional_edge_width(val) diff --git a/kitty/options/utils.py b/kitty/options/utils.py index 0bfba5183..fb8d3f647 100644 --- a/kitty/options/utils.py +++ b/kitty/options/utils.py @@ -766,6 +766,15 @@ def watcher(val: str, current_val: Container[str]) -> Iterable[Tuple[str, str]]: yield val, val +def shell_integration(x: str) -> str: + s = {'enabled', 'disabled', 'no-rc', 'no-cursor', 'no-title', 'no-prompt-mark', 'no-complete'} + q = set(x.split()) + if not q.issubset(s): + log_error(f'Invalid shell integration options: {q - s}, ignoring') + return ' '.join(q & s) + return x + + def action_alias(val: str) -> Iterable[Tuple[str, str]]: parts = val.split(maxsplit=1) if len(parts) > 1: