diff --git a/guake/data/org.guake.gschema.xml b/guake/data/org.guake.gschema.xml index cad5252fa..ef207ca2d 100644 --- a/guake/data/org.guake.gschema.xml +++ b/guake/data/org.guake.gschema.xml @@ -106,6 +106,11 @@ Tab on top. 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. + + true + Wrap around when switching tabs + 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. + false New tabs appear after the current tab. diff --git a/guake/data/prefs.glade b/guake/data/prefs.glade index 1e31db6a2..6f5a11402 100644 --- a/guake/data/prefs.glade +++ b/guake/data/prefs.glade @@ -1164,6 +1164,24 @@ 4 + + + Wrap around when switching tabs + True + True + False + When disabled, switching to the next or previous tab stops at the last and first tab. + start + True + True + True + + + + 1 + 5 + + Set window title to current tab name diff --git a/guake/guake_app.py b/guake/guake_app.py index f81e7bcb1..0e89ebf6e 100644 --- a/guake/guake_app.py +++ b/guake/guake_app.py @@ -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): diff --git a/guake/prefs.py b/guake/prefs.py index 42c240625..460204f6a 100644 --- a/guake/prefs.py +++ b/guake/prefs.py @@ -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()) @@ -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) diff --git a/releasenotes/notes/wrap_tabs-76af94793ead3b46.yaml b/releasenotes/notes/wrap_tabs-76af94793ead3b46.yaml new file mode 100644 index 000000000..17e2fe6f3 --- /dev/null +++ b/releasenotes/notes/wrap_tabs-76af94793ead3b46.yaml @@ -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.