Skip to content

Commit

Permalink
Merge pull request #767 from x000zh/master
Browse files Browse the repository at this point in the history
add new tab after current tab option
  • Loading branch information
mattrose authored Jun 21, 2023
2 parents c96ebf7 + cd04443 commit 0fea7d4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
2 changes: 2 additions & 0 deletions terminatorlib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
'link_single_click' : False,
'title_at_bottom' : False,
'detachable_tabs' : True,

'new_tab_after_current_tab': False,
},
'keybindings': {
'zoom_in' : '<Control>plus',
Expand Down
2 changes: 2 additions & 0 deletions terminatorlib/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ def newtab(self, debugtab=False, widget=None, cwd=None, metadata=None, profile=N

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

Expand Down
19 changes: 18 additions & 1 deletion terminatorlib/preferences.glade
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down
11 changes: 10 additions & 1 deletion terminatorlib/prefseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ def set_values(self):
# 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'])
Expand Down Expand Up @@ -888,6 +892,11 @@ def on_title_at_bottom_checkbutton_toggled(self, widget):
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()
Expand Down

0 comments on commit 0fea7d4

Please sign in to comment.