Merge in jkakar's quick tab switching branch, with minor changes. To avoid bikeshed issues, the bindings are disabled by default.

This commit is contained in:
Thomas Hurst 2009-01-21 08:29:32 +00:00
commit bc24c98164
5 changed files with 55 additions and 0 deletions

View File

@ -319,6 +319,12 @@ Default value: \fB<Ctrl>Page_Down\fR
Move to the previous tab.
Default value: \fB<Ctrl>Page_Up\fR
.TP
.B switch_to_tab_1 - switch_to_tab_10
Keys to switch directly to the numbered tab.
Note that <Alt><Shift>1 may need to be provided as <Alt>! 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

View File

@ -136,6 +136,16 @@ Defaults = {
'scaled_zoom' : '<Ctrl><Shift>Z',
'next_tab' : '<Ctrl>Page_Down',
'prev_tab' : '<Ctrl>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' : '<Ctrl><Shift>R',
'reset_clear' : '<Ctrl><Shift>G',

View File

@ -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.

View File

@ -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)

View File

@ -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)