From 4d88e9938cedc30267d0e7dbdb427c99160fdb1c Mon Sep 17 00:00:00 2001 From: roshal Date: Fri, 3 Jan 2025 06:53:55 +0300 Subject: [PATCH] update --- kitty/conf/generate.py | 11 +- kitty/options/types.py | 873 +++++++++++++++++++++-------------------- 2 files changed, 447 insertions(+), 437 deletions(-) diff --git a/kitty/conf/generate.py b/kitty/conf/generate.py index af6207426..d9e425451 100644 --- a/kitty/conf/generate.py +++ b/kitty/conf/generate.py @@ -4,7 +4,6 @@ import inspect import os -import pprint import re import textwrap from typing import Any, Callable, Dict, Iterator, List, Set, Tuple, Union, get_type_hints @@ -279,6 +278,7 @@ def generate_class(defn: Definition, loc: str) -> Tuple[str, str]: a('') a('') a('defaults = Options()') + a('') for option_name, (typ, mval) in is_mutiple_vars.items(): a(f'defaults.{option_name} = {mval[""]!r}') if mval['macos']: @@ -290,6 +290,7 @@ def generate_class(defn: Definition, loc: str) -> Tuple[str, str]: a('if not is_macos:') a(f' defaults.{option_name}.update({mval["linux"]!r}') + a('') for aname, func in action_parsers.items(): a(f'defaults.{aname} = [') only: Dict[str, List[Tuple[str, Callable[..., Any]]]] = {} @@ -304,6 +305,7 @@ def generate_class(defn: Definition, loc: str) -> Tuple[str, str]: a(f' # {sc.name}') a(f' {val!r},') a(']') + a('') if only: imports.add(('kitty.constants', 'is_macos')) for cond, items in only.items(): @@ -312,6 +314,7 @@ def generate_class(defn: Definition, loc: str) -> Tuple[str, str]: for (text, parser_func) in items: for val in parser_func(text): a(f' defaults.{aname}.append({val!r})') + a('') t('') t('') @@ -385,8 +388,10 @@ def generate_class(defn: Definition, loc: str) -> Tuple[str, str]: a(f'{name} = {cdefn}') a('') - a('option_names = ( # {{''{') - a(' ' + pprint.pformat(tuple(sorted(option_names, key=natural_keys)))[1:] + ' # }}''}') + a('option_names = (') + for option_name in sorted(option_names, key=natural_keys): + a(f' {option_name!r},') + a(')') class_def = '\n'.join(preamble + ['', ''] + class_lines) preamble = ['# generated by gen-config.py DO NOT edit', ''] diff --git a/kitty/options/types.py b/kitty/options/types.py index d0909dfc1..44929ddb5 100644 --- a/kitty/options/types.py +++ b/kitty/options/types.py @@ -37,440 +37,441 @@ choices_for_undercurl_style = typing.Literal['thin-sparse', 'thin-dense', 'thick choices_for_underline_hyperlinks = typing.Literal['hover', 'always', 'never'] choices_for_window_logo_position = choices_for_placement_strategy -option_names = ( # {{{ - 'action_alias', - 'active_border_color', - 'active_tab_background', - 'active_tab_font_style', - 'active_tab_foreground', - 'active_tab_title_template', - 'allow_cloning', - 'allow_hyperlinks', - 'allow_remote_control', - 'background', - 'background_blur', - 'background_image', - 'background_image_layout', - 'background_image_linear', - 'background_opacity', - 'background_tint', - 'background_tint_gaps', - 'bell_border_color', - 'bell_on_tab', - 'bell_path', - 'bold_font', - 'bold_italic_font', - 'box_drawing_scale', - 'clear_all_mouse_actions', - 'clear_all_shortcuts', - 'click_interval', - 'clipboard_control', - 'clipboard_max_size', - 'clone_source_strategies', - 'close_on_child_death', - 'color0', - 'color1', - 'color2', - 'color3', - 'color4', - 'color5', - 'color6', - 'color7', - 'color8', - 'color9', - 'color10', - 'color11', - 'color12', - 'color13', - 'color14', - 'color15', - 'color16', - 'color17', - 'color18', - 'color19', - 'color20', - 'color21', - 'color22', - 'color23', - 'color24', - 'color25', - 'color26', - 'color27', - 'color28', - 'color29', - 'color30', - 'color31', - 'color32', - 'color33', - 'color34', - 'color35', - 'color36', - 'color37', - 'color38', - 'color39', - 'color40', - 'color41', - 'color42', - 'color43', - 'color44', - 'color45', - 'color46', - 'color47', - 'color48', - 'color49', - 'color50', - 'color51', - 'color52', - 'color53', - 'color54', - 'color55', - 'color56', - 'color57', - 'color58', - 'color59', - 'color60', - 'color61', - 'color62', - 'color63', - 'color64', - 'color65', - 'color66', - 'color67', - 'color68', - 'color69', - 'color70', - 'color71', - 'color72', - 'color73', - 'color74', - 'color75', - 'color76', - 'color77', - 'color78', - 'color79', - 'color80', - 'color81', - 'color82', - 'color83', - 'color84', - 'color85', - 'color86', - 'color87', - 'color88', - 'color89', - 'color90', - 'color91', - 'color92', - 'color93', - 'color94', - 'color95', - 'color96', - 'color97', - 'color98', - 'color99', - 'color100', - 'color101', - 'color102', - 'color103', - 'color104', - 'color105', - 'color106', - 'color107', - 'color108', - 'color109', - 'color110', - 'color111', - 'color112', - 'color113', - 'color114', - 'color115', - 'color116', - 'color117', - 'color118', - 'color119', - 'color120', - 'color121', - 'color122', - 'color123', - 'color124', - 'color125', - 'color126', - 'color127', - 'color128', - 'color129', - 'color130', - 'color131', - 'color132', - 'color133', - 'color134', - 'color135', - 'color136', - 'color137', - 'color138', - 'color139', - 'color140', - 'color141', - 'color142', - 'color143', - 'color144', - 'color145', - 'color146', - 'color147', - 'color148', - 'color149', - 'color150', - 'color151', - 'color152', - 'color153', - 'color154', - 'color155', - 'color156', - 'color157', - 'color158', - 'color159', - 'color160', - 'color161', - 'color162', - 'color163', - 'color164', - 'color165', - 'color166', - 'color167', - 'color168', - 'color169', - 'color170', - 'color171', - 'color172', - 'color173', - 'color174', - 'color175', - 'color176', - 'color177', - 'color178', - 'color179', - 'color180', - 'color181', - 'color182', - 'color183', - 'color184', - 'color185', - 'color186', - 'color187', - 'color188', - 'color189', - 'color190', - 'color191', - 'color192', - 'color193', - 'color194', - 'color195', - 'color196', - 'color197', - 'color198', - 'color199', - 'color200', - 'color201', - 'color202', - 'color203', - 'color204', - 'color205', - 'color206', - 'color207', - 'color208', - 'color209', - 'color210', - 'color211', - 'color212', - 'color213', - 'color214', - 'color215', - 'color216', - 'color217', - 'color218', - 'color219', - 'color220', - 'color221', - 'color222', - 'color223', - 'color224', - 'color225', - 'color226', - 'color227', - 'color228', - 'color229', - 'color230', - 'color231', - 'color232', - 'color233', - 'color234', - 'color235', - 'color236', - 'color237', - 'color238', - 'color239', - 'color240', - 'color241', - 'color242', - 'color243', - 'color244', - 'color245', - 'color246', - 'color247', - 'color248', - 'color249', - 'color250', - 'color251', - 'color252', - 'color253', - 'color254', - 'color255', - 'command_on_bell', - 'confirm_os_window_close', - 'copy_on_select', - 'cursor', - 'cursor_beam_thickness', - 'cursor_blink_interval', - 'cursor_shape', - 'cursor_shape_unfocused', - 'cursor_stop_blinking_after', - 'cursor_text_color', - 'cursor_trail', - 'cursor_trail_decay', - 'cursor_trail_start_threshold', - 'cursor_underline_thickness', - 'default_pointer_shape', - 'detect_urls', - 'dim_opacity', - 'disable_ligatures', - 'draw_minimal_borders', - 'dynamic_background_opacity', - 'editor', - 'enable_audio_bell', - 'enabled_layouts', - 'env', - 'exe_search_path', - 'file_transfer_confirmation_bypass', - 'filter_notification', - 'focus_follows_mouse', - 'font_family', - 'font_features', - 'font_size', - 'force_ltr', - 'foreground', - 'forward_stdio', - 'hide_window_decorations', - 'inactive_border_color', - 'inactive_tab_background', - 'inactive_tab_font_style', - 'inactive_tab_foreground', - 'inactive_text_alpha', - 'initial_window_height', - 'initial_window_width', - 'input_delay', - 'italic_font', - 'kitten_alias', - 'kitty_mod', - 'linux_bell_theme', - 'linux_display_server', - 'listen_on', - 'macos_colorspace', - 'macos_custom_beam_cursor', - 'macos_hide_from_tasks', - 'macos_menubar_title_max_length', - 'macos_option_as_alt', - 'macos_quit_when_last_window_closed', - 'macos_show_window_title_in', - 'macos_thicken_font', - 'macos_titlebar_color', - 'macos_traditional_fullscreen', - 'macos_window_resizable', - 'map', - 'mark1_background', - 'mark1_foreground', - 'mark2_background', - 'mark2_foreground', - 'mark3_background', - 'mark3_foreground', - 'menu_map', - 'modify_font', - 'mouse_hide_wait', - 'mouse_map', - 'narrow_symbols', - 'notify_on_cmd_finish', - 'open_url_with', - 'paste_actions', - 'placement_strategy', - 'pointer_shape_when_dragging', - 'pointer_shape_when_grabbed', - 'remember_window_size', - 'remote_control_password', - 'repaint_delay', - 'resize_debounce_time', - 'resize_in_steps', - 'scrollback_fill_enlarged_window', - 'scrollback_indicator_opacity', - 'scrollback_lines', - 'scrollback_pager', - 'scrollback_pager_history_size', - 'select_by_word_characters', - 'select_by_word_characters_forward', - 'selection_background', - 'selection_foreground', - 'shell', - 'shell_integration', - 'show_hyperlink_targets', - 'single_window_margin_width', - 'single_window_padding_width', - 'startup_session', - 'strip_trailing_spaces', - 'symbol_map', - 'sync_to_monitor', - 'tab_activity_symbol', - 'tab_bar_align', - 'tab_bar_background', - 'tab_bar_edge', - 'tab_bar_margin_color', - 'tab_bar_margin_height', - 'tab_bar_margin_width', - 'tab_bar_min_tabs', - 'tab_bar_style', - 'tab_fade', - 'tab_powerline_style', - 'tab_separator', - 'tab_switch_strategy', - 'tab_title_max_length', - 'tab_title_template', - 'term', - 'terminfo_type', - 'text_composition_strategy', - 'text_fg_override_threshold', - 'touch_scroll_multiplier', - 'transparent_background_colors', - 'undercurl_style', - 'underline_hyperlinks', - 'update_check_interval', - 'url_color', - 'url_excluded_characters', - 'url_prefixes', - 'url_style', - 'visual_bell_color', - 'visual_bell_duration', - 'visual_window_select_characters', - 'watcher', - 'wayland_enable_ime', - 'wayland_titlebar_color', - 'wheel_scroll_min_lines', - 'wheel_scroll_multiplier', - 'window_alert_on_bell', - 'window_border_width', - 'window_logo_alpha', - 'window_logo_path', - 'window_logo_position', - 'window_logo_scale', - 'window_margin_width', - 'window_padding_width', - 'window_resize_step_cells', - 'window_resize_step_lines') # }}} +option_names = ( + 'action_alias', + 'active_border_color', + 'active_tab_background', + 'active_tab_font_style', + 'active_tab_foreground', + 'active_tab_title_template', + 'allow_cloning', + 'allow_hyperlinks', + 'allow_remote_control', + 'background', + 'background_blur', + 'background_image', + 'background_image_layout', + 'background_image_linear', + 'background_opacity', + 'background_tint', + 'background_tint_gaps', + 'bell_border_color', + 'bell_on_tab', + 'bell_path', + 'bold_font', + 'bold_italic_font', + 'box_drawing_scale', + 'clear_all_mouse_actions', + 'clear_all_shortcuts', + 'click_interval', + 'clipboard_control', + 'clipboard_max_size', + 'clone_source_strategies', + 'close_on_child_death', + 'color0', + 'color1', + 'color2', + 'color3', + 'color4', + 'color5', + 'color6', + 'color7', + 'color8', + 'color9', + 'color10', + 'color11', + 'color12', + 'color13', + 'color14', + 'color15', + 'color16', + 'color17', + 'color18', + 'color19', + 'color20', + 'color21', + 'color22', + 'color23', + 'color24', + 'color25', + 'color26', + 'color27', + 'color28', + 'color29', + 'color30', + 'color31', + 'color32', + 'color33', + 'color34', + 'color35', + 'color36', + 'color37', + 'color38', + 'color39', + 'color40', + 'color41', + 'color42', + 'color43', + 'color44', + 'color45', + 'color46', + 'color47', + 'color48', + 'color49', + 'color50', + 'color51', + 'color52', + 'color53', + 'color54', + 'color55', + 'color56', + 'color57', + 'color58', + 'color59', + 'color60', + 'color61', + 'color62', + 'color63', + 'color64', + 'color65', + 'color66', + 'color67', + 'color68', + 'color69', + 'color70', + 'color71', + 'color72', + 'color73', + 'color74', + 'color75', + 'color76', + 'color77', + 'color78', + 'color79', + 'color80', + 'color81', + 'color82', + 'color83', + 'color84', + 'color85', + 'color86', + 'color87', + 'color88', + 'color89', + 'color90', + 'color91', + 'color92', + 'color93', + 'color94', + 'color95', + 'color96', + 'color97', + 'color98', + 'color99', + 'color100', + 'color101', + 'color102', + 'color103', + 'color104', + 'color105', + 'color106', + 'color107', + 'color108', + 'color109', + 'color110', + 'color111', + 'color112', + 'color113', + 'color114', + 'color115', + 'color116', + 'color117', + 'color118', + 'color119', + 'color120', + 'color121', + 'color122', + 'color123', + 'color124', + 'color125', + 'color126', + 'color127', + 'color128', + 'color129', + 'color130', + 'color131', + 'color132', + 'color133', + 'color134', + 'color135', + 'color136', + 'color137', + 'color138', + 'color139', + 'color140', + 'color141', + 'color142', + 'color143', + 'color144', + 'color145', + 'color146', + 'color147', + 'color148', + 'color149', + 'color150', + 'color151', + 'color152', + 'color153', + 'color154', + 'color155', + 'color156', + 'color157', + 'color158', + 'color159', + 'color160', + 'color161', + 'color162', + 'color163', + 'color164', + 'color165', + 'color166', + 'color167', + 'color168', + 'color169', + 'color170', + 'color171', + 'color172', + 'color173', + 'color174', + 'color175', + 'color176', + 'color177', + 'color178', + 'color179', + 'color180', + 'color181', + 'color182', + 'color183', + 'color184', + 'color185', + 'color186', + 'color187', + 'color188', + 'color189', + 'color190', + 'color191', + 'color192', + 'color193', + 'color194', + 'color195', + 'color196', + 'color197', + 'color198', + 'color199', + 'color200', + 'color201', + 'color202', + 'color203', + 'color204', + 'color205', + 'color206', + 'color207', + 'color208', + 'color209', + 'color210', + 'color211', + 'color212', + 'color213', + 'color214', + 'color215', + 'color216', + 'color217', + 'color218', + 'color219', + 'color220', + 'color221', + 'color222', + 'color223', + 'color224', + 'color225', + 'color226', + 'color227', + 'color228', + 'color229', + 'color230', + 'color231', + 'color232', + 'color233', + 'color234', + 'color235', + 'color236', + 'color237', + 'color238', + 'color239', + 'color240', + 'color241', + 'color242', + 'color243', + 'color244', + 'color245', + 'color246', + 'color247', + 'color248', + 'color249', + 'color250', + 'color251', + 'color252', + 'color253', + 'color254', + 'color255', + 'command_on_bell', + 'confirm_os_window_close', + 'copy_on_select', + 'cursor', + 'cursor_beam_thickness', + 'cursor_blink_interval', + 'cursor_shape', + 'cursor_shape_unfocused', + 'cursor_stop_blinking_after', + 'cursor_text_color', + 'cursor_trail', + 'cursor_trail_decay', + 'cursor_trail_start_threshold', + 'cursor_underline_thickness', + 'default_pointer_shape', + 'detect_urls', + 'dim_opacity', + 'disable_ligatures', + 'draw_minimal_borders', + 'dynamic_background_opacity', + 'editor', + 'enable_audio_bell', + 'enabled_layouts', + 'env', + 'exe_search_path', + 'file_transfer_confirmation_bypass', + 'filter_notification', + 'focus_follows_mouse', + 'font_family', + 'font_features', + 'font_size', + 'force_ltr', + 'foreground', + 'forward_stdio', + 'hide_window_decorations', + 'inactive_border_color', + 'inactive_tab_background', + 'inactive_tab_font_style', + 'inactive_tab_foreground', + 'inactive_text_alpha', + 'initial_window_height', + 'initial_window_width', + 'input_delay', + 'italic_font', + 'kitten_alias', + 'kitty_mod', + 'linux_bell_theme', + 'linux_display_server', + 'listen_on', + 'macos_colorspace', + 'macos_custom_beam_cursor', + 'macos_hide_from_tasks', + 'macos_menubar_title_max_length', + 'macos_option_as_alt', + 'macos_quit_when_last_window_closed', + 'macos_show_window_title_in', + 'macos_thicken_font', + 'macos_titlebar_color', + 'macos_traditional_fullscreen', + 'macos_window_resizable', + 'map', + 'mark1_background', + 'mark1_foreground', + 'mark2_background', + 'mark2_foreground', + 'mark3_background', + 'mark3_foreground', + 'menu_map', + 'modify_font', + 'mouse_hide_wait', + 'mouse_map', + 'narrow_symbols', + 'notify_on_cmd_finish', + 'open_url_with', + 'paste_actions', + 'placement_strategy', + 'pointer_shape_when_dragging', + 'pointer_shape_when_grabbed', + 'remember_window_size', + 'remote_control_password', + 'repaint_delay', + 'resize_debounce_time', + 'resize_in_steps', + 'scrollback_fill_enlarged_window', + 'scrollback_indicator_opacity', + 'scrollback_lines', + 'scrollback_pager', + 'scrollback_pager_history_size', + 'select_by_word_characters', + 'select_by_word_characters_forward', + 'selection_background', + 'selection_foreground', + 'shell', + 'shell_integration', + 'show_hyperlink_targets', + 'single_window_margin_width', + 'single_window_padding_width', + 'startup_session', + 'strip_trailing_spaces', + 'symbol_map', + 'sync_to_monitor', + 'tab_activity_symbol', + 'tab_bar_align', + 'tab_bar_background', + 'tab_bar_edge', + 'tab_bar_margin_color', + 'tab_bar_margin_height', + 'tab_bar_margin_width', + 'tab_bar_min_tabs', + 'tab_bar_style', + 'tab_fade', + 'tab_powerline_style', + 'tab_separator', + 'tab_switch_strategy', + 'tab_title_max_length', + 'tab_title_template', + 'term', + 'terminfo_type', + 'text_composition_strategy', + 'text_fg_override_threshold', + 'touch_scroll_multiplier', + 'transparent_background_colors', + 'undercurl_style', + 'underline_hyperlinks', + 'update_check_interval', + 'url_color', + 'url_excluded_characters', + 'url_prefixes', + 'url_style', + 'visual_bell_color', + 'visual_bell_duration', + 'visual_window_select_characters', + 'watcher', + 'wayland_enable_ime', + 'wayland_titlebar_color', + 'wheel_scroll_min_lines', + 'wheel_scroll_multiplier', + 'window_alert_on_bell', + 'window_border_width', + 'window_logo_alpha', + 'window_logo_path', + 'window_logo_position', + 'window_logo_scale', + 'window_margin_width', + 'window_padding_width', + 'window_resize_step_cells', + 'window_resize_step_lines', +) class Options: @@ -760,6 +761,7 @@ class Options: defaults = Options() + defaults.action_alias = {} defaults.env = {} defaults.exe_search_path = {} @@ -772,6 +774,7 @@ defaults.narrow_symbols = {} defaults.remote_control_password = {} defaults.symbol_map = {} defaults.watcher = {} + defaults.map = [ # copy_to_clipboard KeyDefinition(trigger=SingleKey(mods=256, key=99), definition='copy_to_clipboard'), @@ -924,6 +927,7 @@ defaults.map = [ # debug_config KeyDefinition(trigger=SingleKey(mods=256, key=57369), definition='debug_config'), ] + if is_macos: defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=99), definition='copy_to_clipboard')) defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=118), definition='paste_from_clipboard')) @@ -973,6 +977,7 @@ if is_macos: defaults.map.append(KeyDefinition(trigger=SingleKey(mods=10, key=104), definition='hide_macos_other_apps')) defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=109), definition='minimize_macos_window')) defaults.map.append(KeyDefinition(trigger=SingleKey(mods=8, key=113), definition='quit')) + defaults.mouse_map = [ # click_url_or_select MouseMapping(repeat_count=-2, definition='mouse_handle_click selection link prompt'),