macOS: Fix shortcuts that become entries in the global menubar being reported as removed shortcuts in the debug output
This commit is contained in:
parent
f9504b4fba
commit
3b8c7f6dd9
4 changed files with 12 additions and 5 deletions
|
|
@ -79,6 +79,8 @@ Detailed list of changes
|
|||
|
||||
- Fix a regression in the previous release that broke use of the ``cd`` command in session files (:iss:`7829`)
|
||||
|
||||
- macOS: Fix shortcuts that become entries in the global menubar being reported as removed shortcuts in the debug output
|
||||
|
||||
0.36.2 [2024-09-06]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -3034,7 +3034,7 @@ def debug_config(self) -> None:
|
|||
from .debug_config import debug_config
|
||||
w = self.window_for_dispatch or self.active_window
|
||||
if w is not None:
|
||||
output = debug_config(get_options())
|
||||
output = debug_config(get_options(), self.mappings.global_shortcuts)
|
||||
set_clipboard_string(re.sub(r'\x1b.+?m', '', output))
|
||||
output += '\n\x1b[35mThis debug output has been copied to the clipboard\x1b[m'
|
||||
self.display_scrollback(w, output, title=_('Current kitty options'), report_cursor=False)
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ def compare_maps(
|
|||
|
||||
|
||||
|
||||
def compare_opts(opts: KittyOpts, print: Print) -> None:
|
||||
def compare_opts(opts: KittyOpts, global_shortcuts: dict[str, SingleKey] | None, print: Print) -> None:
|
||||
from .config import load_config
|
||||
print()
|
||||
print('Config options different from defaults:')
|
||||
|
|
@ -134,6 +134,11 @@ def as_str(defns: Sequence[KeyDefinition]) -> str:
|
|||
initial = {as_sc(k, v[0]): as_str(v) for k, v in initial_.keymap.items()}
|
||||
final_ = opts.keyboard_modes.get(kmn, KeyboardMode(kmn))
|
||||
final = {as_sc(k, v[0]): as_str(v) for k, v in final_.keymap.items()}
|
||||
if not kmn and global_shortcuts:
|
||||
for action, sk in global_shortcuts.items():
|
||||
sc = Shortcut((sk,))
|
||||
if sc not in final:
|
||||
final[sc] = action
|
||||
compare_maps(final, opts.kitty_mod, initial, default_opts.kitty_mod, print, mode_name=kmn)
|
||||
new_keyboard_modes = set(opts.keyboard_modes) - set(default_opts.keyboard_modes)
|
||||
for kmn in new_keyboard_modes:
|
||||
|
|
@ -229,7 +234,7 @@ def compositor_name() -> str:
|
|||
return ans
|
||||
|
||||
|
||||
def debug_config(opts: KittyOpts) -> str:
|
||||
def debug_config(opts: KittyOpts, global_shortcuts: dict[str, SingleKey] | None = None) -> str:
|
||||
from io import StringIO
|
||||
out = StringIO()
|
||||
p = partial(print, file=out)
|
||||
|
|
@ -276,7 +281,7 @@ def debug_config(opts: KittyOpts) -> str:
|
|||
if opts.config_overrides:
|
||||
p(green('Loaded config overrides:'))
|
||||
p(' ', '\n '.join(opts.config_overrides))
|
||||
compare_opts(opts, p)
|
||||
compare_opts(opts, global_shortcuts, p)
|
||||
p()
|
||||
p(green('Important environment variables seen by the kitty process:'))
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ def __init__(self, global_shortcuts:Optional[dict[str, SingleKey]] = None, callb
|
|||
def current_keyboard_mode_name(self) -> str:
|
||||
return self.keyboard_mode_stack[-1].name if self.keyboard_mode_stack else ''
|
||||
|
||||
def update_keymap(self, global_shortcuts:Optional[dict[str, SingleKey]] = None) -> None:
|
||||
def update_keymap(self, global_shortcuts: Optional[dict[str, SingleKey]] = None) -> None:
|
||||
if global_shortcuts is None:
|
||||
global_shortcuts = self.set_cocoa_global_shortcuts(self.get_options()) if is_macos else {}
|
||||
self.global_shortcuts_map: KeyMap = {v: [KeyDefinition(definition=k)] for k, v in global_shortcuts.items()}
|
||||
|
|
|
|||
Loading…
Reference in a new issue