From b8119760186d5f00479fac2322fee3bb1507d323 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 28 Feb 2021 21:42:57 +0530 Subject: [PATCH] Ensure global shortcuts are never sent to children This was happening with ctrl+tab and ctrl+shift+tab because cocoa eats these and so glfw has a workaround to always send them. If they are added as global shortcuts, for exmaple for next/previous tab they were then being sent to children --- kitty/boss.py | 3 +++ kitty/config.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kitty/boss.py b/kitty/boss.py index 5514470a5..b261ddf59 100755 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -168,6 +168,7 @@ class Boss: set_boss(self) self.opts, self.args = opts, args self.keymap = self.opts.keymap.copy() + self.global_shortcuts_map = {v: KeyAction(k) for k, v in global_shortcuts.items()} for sc in global_shortcuts.values(): self.keymap.pop(sc, None) if is_macos: @@ -668,6 +669,8 @@ class Boss: self.pending_sequences = sequences set_in_sequence_mode(True) return True + if self.global_shortcuts_map and get_shortcut(self.global_shortcuts_map, ev): + return True elif isinstance(key_action, KeyAction): return self.dispatch_action(key_action) diff --git a/kitty/config.py b/kitty/config.py index 991760b50..3d1c2668e 100644 --- a/kitty/config.py +++ b/kitty/config.py @@ -35,7 +35,7 @@ SequenceMap = Dict[SingleKey, SubSequenceMap] class KeyAction(NamedTuple): func: str - args: Sequence[str] + args: Sequence[str] = () func_with_args, args_funcs = key_func()