Closing tab on middle mouse button press

Motivation: Most of the applications with tabs support such way
of closing tabs.
This commit is contained in:
kocho1984 2021-06-20 04:23:11 +02:00
parent f4a3c4e3ad
commit 33768f01b7
1 changed files with 6 additions and 0 deletions

View File

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