diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 5af70102..3b92ed22 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -319,6 +319,12 @@ Default value: \fBPage_Down\fR Move to the previous tab. Default value: \fBPage_Up\fR .TP +.B switch_to_tab_1 - switch_to_tab_10 +Keys to switch directly to the numbered tab. +Note that 1 may need to be provided as ! or similar, +depending on your keyboard layout. +Default value: \fBUnbound\fR +.TP .B full_screen Toggle the window to a fullscreen window. Default value: \fBF11\fR diff --git a/terminatorlib/config.py b/terminatorlib/config.py index ad8602ed..1eaaacc1 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -136,6 +136,16 @@ Defaults = { 'scaled_zoom' : 'Z', 'next_tab' : 'Page_Down', 'prev_tab' : 'Page_Up', + 'switch_to_tab_1' : None, + 'switch_to_tab_2' : None, + 'switch_to_tab_3' : None, + 'switch_to_tab_4' : None, + 'switch_to_tab_5' : None, + 'switch_to_tab_6' : None, + 'switch_to_tab_7' : None, + 'switch_to_tab_8' : None, + 'switch_to_tab_9' : None, + 'switch_to_tab_10' : None, 'full_screen' : 'F11', 'reset' : 'R', 'reset_clear' : 'G', diff --git a/terminatorlib/keybindings.py b/terminatorlib/keybindings.py index 60bd64a1..c39514f4 100644 --- a/terminatorlib/keybindings.py +++ b/terminatorlib/keybindings.py @@ -39,6 +39,9 @@ class TerminatorKeybindings: bindings = (bindings,) for binding in bindings: + if binding is None: + continue + try: keyval, mask = self._parsebinding(binding) # Does much the same, but with poorer error handling. diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 3e6388c7..e591f92b 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -1127,6 +1127,12 @@ class Terminator: notebook.next_page() notebook.set_current_page(notebook.get_current_page()) + def switch_to_tab(self, term, index): + notebook = self.get_first_parent_notebook(term) + if notebook: + notebook.set_current_page(index) + notebook.set_current_page(notebook.get_current_page()) + def move_tab(self, term, direction): dbg("moving to direction %s" % direction) (notebook, page) = self.get_first_notebook_page(term) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 81a4d46c..e028e432 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -829,6 +829,36 @@ text/plain def key_prev_tab(self): self.terminator.previous_tab (self) + def key_switch_to_tab_1(self): + self.terminator.switch_to_tab (self, 0) + + def key_switch_to_tab_2(self): + self.terminator.switch_to_tab (self, 1) + + def key_switch_to_tab_3(self): + self.terminator.switch_to_tab (self, 2) + + def key_switch_to_tab_4(self): + self.terminator.switch_to_tab (self, 3) + + def key_switch_to_tab_5(self): + self.terminator.switch_to_tab (self, 4) + + def key_switch_to_tab_6(self): + self.terminator.switch_to_tab (self, 5) + + def key_switch_to_tab_7(self): + self.terminator.switch_to_tab (self, 6) + + def key_switch_to_tab_8(self): + self.terminator.switch_to_tab (self, 7) + + def key_switch_to_tab_9(self): + self.terminator.switch_to_tab (self, 8) + + def key_switch_to_tab_10(self): + self.terminator.switch_to_tab (self, 9) + def key_reset(self): self._vte.reset (True, False)