Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions guake/data/org.guake.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@
<summary>Tab on top.</summary>
<description>Makes tab bar on top of the Guake window. Per default, tabs appear below the terminal. Setting this to True will move the tab on top of the terminal. Requires a restart.</description>
</key>
<key name="wrap-tabs" type="b">
<default>true</default>
<summary>Wrap around when switching tabs</summary>
<description>When true, going to the next tab from the last one moves to the first, and going to the previous tab from the first one moves to the last. When false, switching tabs stops at the first and last tab.</description>
</key>
<key name="new-tab-after" type="b">
<default>false</default>
<summary>New tabs appear after the current tab.</summary>
Expand Down
18 changes: 18 additions & 0 deletions guake/data/prefs.glade
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,24 @@
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="wrap_tabs">
<property name="label" translatable="yes">Wrap around when switching tabs</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes">When disabled, switching to the next or previous tab stops at the last and first tab.</property>
<property name="halign">start</property>
<property name="use-underline">True</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
<signal name="toggled" handler="on_wrap_tabs_toggled" swapped="no"/>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="set_window_title">
<property name="label" translatable="yes">Set window title to current tab name</property>
Expand Down
16 changes: 10 additions & 6 deletions guake/guake_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,18 +1019,22 @@ def accel_add_cwd(self, *args):

def accel_prev(self, *args):
"""Callback to go to the previous tab. Called by the accel key."""
if self.get_notebook().get_current_page() == 0:
self.get_notebook().set_current_page(self.get_notebook().get_n_pages() - 1)
notebook = self.get_notebook()
if notebook.get_current_page() == 0:
if self.settings.general.get_boolean("wrap-tabs"):
notebook.set_current_page(notebook.get_n_pages() - 1)
else:
self.get_notebook().prev_page()
notebook.prev_page()
return True

def accel_next(self, *args):
"""Callback to go to the next tab. Called by the accel key."""
if self.get_notebook().get_current_page() + 1 == self.get_notebook().get_n_pages():
self.get_notebook().set_current_page(0)
notebook = self.get_notebook()
if notebook.get_current_page() + 1 == notebook.get_n_pages():
if self.settings.general.get_boolean("wrap-tabs"):
notebook.set_current_page(0)
else:
self.get_notebook().next_page()
notebook.next_page()
return True

def accel_move_tab_left(self, *args):
Expand Down
8 changes: 8 additions & 0 deletions guake/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ def on_hide_tabs_if_one_tab_toggled(self, chk):
"""Changes the activity of hide_tabs_if_one_tab in dconf"""
self.settings.general.set_boolean("hide-tabs-if-one-tab", chk.get_active())

def on_wrap_tabs_toggled(self, chk):
"""Changes the activity of wrap_tabs in dconf"""
self.settings.general.set_boolean("wrap-tabs", chk.get_active())

def on_start_fullscreen_toggled(self, chk):
"""Changes the activity of start_fullscreen in dconf"""
self.settings.general.set_boolean("start-fullscreen", chk.get_active())
Expand Down Expand Up @@ -1198,6 +1202,10 @@ def load_configs(self):
value = self.settings.general.get_boolean("hide-tabs-if-one-tab")
self.get_widget("hide_tabs_if_one_tab").set_active(value)

# wrap around when switching tabs
value = self.settings.general.get_boolean("wrap-tabs")
self.get_widget("wrap_tabs").set_active(value)

# start fullscreen
value = self.settings.general.get_boolean("start-fullscreen")
self.get_widget("start_fullscreen").set_active(value)
Expand Down
10 changes: 10 additions & 0 deletions releasenotes/notes/wrap_tabs-76af94793ead3b46.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
release_summary: >
Switching to the next or previous tab can now stop at the last and first tab
instead of wrapping around.

features:
- |
- New "Wrap around when switching tabs" preference, in Main Window. It is
enabled by default, as before. When disabled, the next and previous tab
shortcuts stop at the last and first tab, which also matches what the
mouse wheel over the tab bar already does.