add new tab after current tab option

This commit is contained in:
x000zh 2023-06-04 19:13:37 +08:00
parent e0592eaf4f
commit cd04443e29
4 changed files with 32 additions and 2 deletions

View File

@ -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' : '<Control>plus',

View File

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

View File

@ -1245,7 +1245,7 @@
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="row-spacing">6</property>
<property name="row-spacing">8</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel" id="label11">
@ -1330,6 +1330,23 @@
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="new_tab_after_current_checkbutton">
<property name="label" translatable="yes">New tab after current tab</property>
<property name="use-action-appearance">False</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="xalign">0</property>
<property name="draw-indicator">True</property>
<signal name="toggled" handler="on_new_tab_after_current_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>

View File

@ -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()