From cd04443e292c596e1abb497d92b400eff157f648 Mon Sep 17 00:00:00 2001 From: x000zh Date: Sun, 4 Jun 2023 19:13:37 +0800 Subject: [PATCH] add new tab after current tab option --- terminatorlib/config.py | 2 ++ terminatorlib/notebook.py | 2 ++ terminatorlib/preferences.glade | 19 ++++++++++++++++++- terminatorlib/prefseditor.py | 11 ++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index dcd982ab..7a7d10f8 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -119,6 +119,8 @@ DEFAULTS = { 'link_single_click' : False, 'title_at_bottom' : False, 'detachable_tabs' : True, + + 'new_tab_after_current_tab': False, }, 'keybindings': { 'zoom_in' : 'plus', diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index a6e30298..9cb6bd48 100644 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -306,6 +306,8 @@ class Notebook(Container, Gtk.Notebook): if metadata and 'tabnum' in metadata: tabpos = metadata['tabnum'] + elif self.config['new_tab_after_current_tab'] == True: + tabpos = self.get_current_page() + 1 else: tabpos = -1 diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 85755383..fd18a16d 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -1245,7 +1245,7 @@ True False - 6 + 8 12 @@ -1330,6 +1330,23 @@ 2 + + + New tab after current tab + False + True + True + False + 0 + True + + + + 0 + 4 + 2 + + True diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 15ffef88..82fad666 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -356,7 +356,11 @@ class PrefsEditor: # title bar at bottom widget = guiget('title_at_bottom_checkbutton') widget.set_active(self.config['title_at_bottom']) - + + # new tab after current tab + widget = guiget('new_tab_after_current_checkbutton') + widget.set_active(self.config['new_tab_after_current_tab']) + #Always split with profile widget = guiget('always_split_with_profile') widget.set_active(self.config['always_split_with_profile']) @@ -888,6 +892,11 @@ class PrefsEditor: self.config['title_at_bottom'] = widget.get_active() self.config.save() + def on_new_tab_after_current_checkbutton_toggled(self, widget): + """New tab after current tab """ + self.config['new_tab_after_current_tab'] = widget.get_active() + self.config.save() + def on_always_split_with_profile_toggled(self, widget): """Always split with profile setting changed""" self.config['always_split_with_profile'] = widget.get_active()