55import sys
66from contextlib import suppress
77from functools import partial
8+ from types import MappingProxyType
89from typing import Any , Iterable , Mapping , Sequence
910
1011from kitty .cli import parse_args
@@ -96,8 +97,8 @@ def layer_shell_config(opts: PanelCLIOptions) -> LayerShellConfig:
9697
9798
9899@run_once
99- def cli_option_to_lsc_configs_map () -> dict [str , tuple [str , ...]]:
100- return {
100+ def cli_option_to_lsc_configs_map () -> MappingProxyType [str , tuple [str , ...]]:
101+ return MappingProxyType ( {
101102 'lines' : ('y_size_in_cells' , 'y_size_in_pixels' ),
102103 'columns' : ('x_size_in_cells' , 'x_size_in_pixels' ),
103104 'margin_top' : ('requested_top_margin' ,),
@@ -111,7 +112,7 @@ def cli_option_to_lsc_configs_map() -> dict[str, tuple[str, ...]]:
111112 'exclusive_zone' : ('requested_exclusive_zone' ,),
112113 'override_exclusive_zone' : ('override_exclusive_zone' ,),
113114 'hide_on_focus_loss' : ('hide_on_focus_loss' ,)
114- }
115+ })
115116
116117
117118def incrementally_update_layer_shell_config (existing : dict [str , Any ], cli_options : Iterable [str ]) -> LayerShellConfig :
@@ -127,7 +128,7 @@ def incrementally_update_layer_shell_config(existing: dict[str, Any], cli_option
127128 raise ValueError (f'Invalid panel options specified: { e } ' )
128129 lsc_cli_map = cli_option_to_lsc_configs_map ()
129130 for option in seen_options :
130- for config in lsc_cli_map [ option ] :
131+ for config in lsc_cli_map . get ( option , ()) :
131132 existing [config ] = getattr (lsc , config )
132133 if seen_options .get ('edge' ) == 'background' :
133134 existing ['type' ] = GLFW_LAYER_SHELL_BACKGROUND
0 commit comments