From 618e38d18bffaccca53cbb2d97934348ef9fcd92 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 24 Jun 2012 20:42:12 +0200 Subject: [PATCH] Clicking with modifier on the group button gives more powerful control. (Shift: Rename, Ctrl: Join current, Super: Include siblings) --- terminatorlib/terminal.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 47e55838..5add2820 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -772,7 +772,40 @@ class Terminal(gtk.VBox): def on_group_button_press(self, widget, event): """Handler for the group button""" if event.button == 1: - self.create_popup_group_menu(widget, event) + if event.type == gtk.gdk._2BUTTON_PRESS or \ + event.type == gtk.gdk._3BUTTON_PRESS: + # Ignore these, or they make the interaction bad + return False + # Super key applies interaction to all terms in group + include_siblings=event.state & gtk.gdk.MOD4_MASK == gtk.gdk.MOD4_MASK + if include_siblings: + targets=self.terminator.get_sibling_terms(self) + else: + targets=[self] + if event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK: + dbg('on_group_button_press: toggle terminal to focused terminals group') + focused=self.get_toplevel().get_focussed_terminal() + if focused in targets: targets.remove(focused) + if self != focused: + if self.group==focused.group: + new_group=None + else: + new_group=focused.group + [term.set_group(None, new_group) for term in targets] + [term.titlebar.update(focused) for term in targets] + return True + elif event.state & gtk.gdk.SHIFT_MASK == gtk.gdk.SHIFT_MASK: + dbg('on_group_button_press: rename of terminals group') + self.targets_for_new_group = targets + self.titlebar.create_group() + return True + elif event.type == gtk.gdk.BUTTON_PRESS: + # Single Click gives popup + dbg('on_group_button_press: group menu popup') + self.create_popup_group_menu(widget, event) + return True + else: + dbg('on_group_button_press: unknown group button interaction') return(False) def on_keypress(self, widget, event):