From d9205d83d964e04268ed3c1626c969354fde65a0 Mon Sep 17 00:00:00 2001 From: Jamu Kakar Date: Tue, 20 Jan 2009 21:18:59 -0800 Subject: [PATCH] - Alt-N switches to the tab at index N for values of 0 >= N <= 9. This makes switching to arbitrary tabs very quick. --- terminatorlib/config.py | 10 ++++++++++ terminatorlib/terminator.py | 6 ++++++ terminatorlib/terminatorterm.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index ad8602ed..c79f1ef1 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', + 'first_tab' : '1', + 'second_tab' : '2', + 'third_tab' : '3', + 'fourth_tab' : '4', + 'fifth_tab' : '5', + 'sixth_tab' : '6', + 'seventh_tab' : '7', + 'eighth_tab' : '8', + 'ninth_tab' : '9', + 'tenth_tab' : '0', 'full_screen' : 'F11', 'reset' : 'R', 'reset_clear' : 'G', 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..1581134f 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_first_tab(self): + self.terminator.switch_to_tab (self, 0) + + def key_second_tab(self): + self.terminator.switch_to_tab (self, 1) + + def key_third_tab(self): + self.terminator.switch_to_tab (self, 2) + + def key_fourth_tab(self): + self.terminator.switch_to_tab (self, 3) + + def key_fifth_tab(self): + self.terminator.switch_to_tab (self, 4) + + def key_sixth_tab(self): + self.terminator.switch_to_tab (self, 5) + + def key_seventh_tab(self): + self.terminator.switch_to_tab (self, 6) + + def key_eighth_tab(self): + self.terminator.switch_to_tab (self, 7) + + def key_ninth_tab(self): + self.terminator.switch_to_tab (self, 8) + + def key_tenth_tab(self): + self.terminator.switch_to_tab (self, 9) + def key_reset(self): self._vte.reset (True, False)