From dcda2bff695c463938b6c8c12d498f6c6dd09d9f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Oct 2021 14:05:54 +0530 Subject: [PATCH] Handle more than 10 windows when doing a visual switch --- kitty/boss.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kitty/boss.py b/kitty/boss.py index a906aa470..aff921e1c 100755 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -821,12 +821,17 @@ class Boss: count = 0 fmap = get_name_to_functional_number_map() for idx, window in tab.windows.iter_windows_with_number(only_visible=True): + if idx > 9: + break count += 1 - window.screen.set_window_number(idx + 1) + num = idx + 1 ac = KeyAction('focus_visible_window_trigger', (idx,)) + if num == 10: + num = 0 + window.screen.set_window_number(num) for mods in (0, GLFW_MOD_CONTROL, GLFW_MOD_CONTROL | GLFW_MOD_SHIFT, GLFW_MOD_SUPER, GLFW_MOD_ALT, GLFW_MOD_SHIFT): - pending_sequences[(SingleKey(mods=mods, key=ord(str(idx + 1))),)] = ac - pending_sequences[(SingleKey(mods=mods, key=fmap[f'KP_{idx+1}']),)] = ac + pending_sequences[(SingleKey(mods=mods, key=ord(str(num))),)] = ac + pending_sequences[(SingleKey(mods=mods, key=fmap[f'KP_{num}']),)] = ac if count > 1: self.set_pending_sequences(pending_sequences, default_pending_action=KeyAction('focus_visible_window_trigger')) redirect_mouse_handling(True)