From a7f5679a03fcd0778e773e83361d4fa5bf30f730 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Thu, 7 May 2020 08:30:08 +0200 Subject: [PATCH] Propagate tab-swictch events if there is only one tab --- terminatorlib/terminal.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 6a2a445b..2e743e88 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -885,6 +885,20 @@ def on_keypress(self, widget, event): # FIXME: Does keybindings really want to live in Terminator()? mapping = self.terminator.keybindings.lookup(event) + # Just propagate tab-swictch events if there is only one tab + if ( + mapping and ( + mapping.startswith('switch_to_tab') or + mapping in ('next_tab', 'prev_tab') + ) + ): + window = self.get_toplevel() + child = window.get_children()[0] + if isinstance(child, Terminal): + # not a Notebook instance => a single tab is used + # .get_n_pages() can not be used + return(False) + if mapping == "hide_window": return(False)