Skip to content

Commit

Permalink
Merge pull request #451 from kocho1984/close_tab_on_middle_button
Browse files Browse the repository at this point in the history
Closing tab on middle mouse button press
  • Loading branch information
mattrose committed Jun 24, 2021
2 parents 5206952 + 33768f0 commit 24f1503
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions terminatorlib/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ def __init__(self, title, notebook):
self.terminator = Terminator()
self.config = Config()

self.connect("button-press-event", self.on_button_pressed)

self.label = EditableLabel(title)
self.update_angle()

Expand Down Expand Up @@ -650,4 +652,8 @@ def on_close(self, _widget):
"""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:

0 comments on commit 24f1503

Please sign in to comment.