From 445fd57eb4818c28bec11af9c976b84883fd1b4b Mon Sep 17 00:00:00 2001 From: lenemter Date: Mon, 16 Feb 2026 15:21:12 +0300 Subject: [PATCH] Super+Tab: create a new workspace when there's just one --- data/gala.metainfo.xml.in | 1 + src/WindowManager.vala | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/data/gala.metainfo.xml.in b/data/gala.metainfo.xml.in index d5763d941..7e80578ff 100644 --- a/data/gala.metainfo.xml.in +++ b/data/gala.metainfo.xml.in @@ -36,6 +36,7 @@ Pinch gestures are switching between workspaces instead of zooming + Super+Tab should create a new workspace when there's just one diff --git a/src/WindowManager.vala b/src/WindowManager.vala index 5a4d4dd16..6aff3af52 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -476,11 +476,24 @@ namespace Gala { return Clutter.EVENT_STOP; } - private void handle_cycle_workspaces (Meta.Display display, Meta.Window? window, Clutter.KeyEvent? event, - Meta.KeyBinding binding) { - var direction = (binding.get_name () == "cycle-workspaces-next" ? 1 : -1); + private void handle_cycle_workspaces ( + Meta.Display display, + Meta.Window? window, + Clutter.KeyEvent? event, + Meta.KeyBinding binding + ) { unowned var manager = display.get_workspace_manager (); var active_workspace_index = manager.get_active_workspace_index (); + + var timestamp = event != null ? event?.get_time () : Meta.CURRENT_TIME; + + // If only 1 populated workspace is present we allow switching to new workspace + if (manager.n_workspaces == 2) { + manager.get_workspace_by_index (1 - active_workspace_index).activate (timestamp); + return; + } + + var direction = binding.get_name () == "cycle-workspaces-next" ? 1 : -1; var index = active_workspace_index + direction; if (index < 0) { @@ -490,7 +503,6 @@ namespace Gala { } if (active_workspace_index != index) { - var timestamp = event != null ? event.get_time () : Meta.CURRENT_TIME; manager.get_workspace_by_index (index).activate (timestamp); } else { InternalUtils.bell_notify (display);