From 33768f01b7e3ac17c73797f39671d828365022f8 Mon Sep 17 00:00:00 2001 From: kocho1984 Date: Sun, 20 Jun 2021 04:23:11 +0200 Subject: [PATCH] Closing tab on middle mouse button press Motivation: Most of the applications with tabs support such way of closing tabs. --- terminatorlib/notebook.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index 9fe0d6bd..aa216a53 100644 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -568,6 +568,8 @@ class TabLabel(Gtk.HBox): self.terminator = Terminator() self.config = Config() + self.connect("button-press-event", self.on_button_pressed) + self.label = EditableLabel(title) self.update_angle() @@ -650,4 +652,8 @@ class TabLabel(Gtk.HBox): """The close button has been clicked. Destroy the tab""" self.emit('close-clicked', self) + def on_button_pressed(self, _widget, event): + if event.button == 2: + self.on_close(_widget) + # vim: set expandtab ts=4 sw=4: