From 71f4cbfebd08e7ebb4effa63de5c81e327487f6a Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Fri, 22 Feb 2008 23:39:59 +0000 Subject: [PATCH] Added keybindings: - Ctrl-Shift-Up or down : move first VPaned handle Up or Down - Ctrl-Shift-Left or Right: move first parent HPaned handle Up or Down -Ctrl-Shift-S: Hide/Show scrollbar --- terminator | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/terminator b/terminator index e05ca154..efc33341 100755 --- a/terminator +++ b/terminator @@ -404,6 +404,12 @@ class TerminatorTerm: elif keyname == 'V': self._vte.paste_clipboard () return (True) + elif keyname == 'S': + self.do_scrollbar_toggle () + return (True) + elif keyname in ('Up', 'Down', 'Left', 'Right'): + self.terminator.resizeterm (self, keyname) + return (True) if keyname and (keyname == 'Tab' or keyname.endswith('_Tab')): if event.state == gtk.gdk.CONTROL_MASK: @@ -477,7 +483,7 @@ class TerminatorTerm: item = gtk.MenuItem () menu.append (item) - item = gtk.CheckMenuItem (_("Show scrollbar")) + item = gtk.CheckMenuItem (_("Show _scrollbar")) item.set_active (self._scrollbar.get_property ('visible')) item.connect ("toggled", lambda menu_item: self.do_scrollbar_toggle ()) menu.append (item) @@ -728,7 +734,54 @@ class Terminator: #self.window.set_title(self.term_list[previous]._vte.get_window_title()) self.term_list[previous]._vte.grab_focus () + + + + def resizeterm (self, widget, keyname): + vertical = False + if keyname in ('Up', 'Down'): + vertical = True + elif keyname in ('Left', 'Right'): + vertical = False + else: + return + parent = self.get_parent_pane(widget.get_box (),vertical) + if parent == None: + return + + #We have a corresponding parent pane + # + #allocation = parent.get_allocation() + + if keyname in ('Up', 'Down'): + maxi = parent.get_child1().get_allocation().height + parent.get_child2().get_allocation().height - 1 + + else: + maxi = parent.get_child1().get_allocation().width + parent.get_child2().get_allocation().width - 1 + move = 10 + if keyname in ('Up', 'Left'): + move = -10 + + + move = max(2, parent.get_position() + move) + move = min(maxi, move) + + parent.set_position(move) + + + def get_parent_pane (self, widget, vertical): + if isinstance (widget, gtk.Window): + return None + parent = widget.get_parent() + if isinstance (parent, gtk.VPaned) and vertical: + return parent + elif isinstance (parent, gtk.HPaned) and not vertical: + return parent + return self.get_parent_pane(parent, vertical) + + + def execute_cb (option, opt, value, parser): assert value is None value = []