From 26173f7cfb17926fcbf4ad54918c2955704ce7a9 Mon Sep 17 00:00:00 2001 From: mauro-balades Date: Mon, 9 Sep 2024 20:27:52 +0200 Subject: [PATCH] Refactor tab navigation logic in ZenWorkspaces.mjs --- src/ZenWorkspaces.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ZenWorkspaces.mjs b/src/ZenWorkspaces.mjs index 5c4a683..2c91f9f 100644 --- a/src/ZenWorkspaces.mjs +++ b/src/ZenWorkspaces.mjs @@ -457,7 +457,9 @@ var ZenWorkspaces = { if ((tab.getAttribute('zen-workspace-id') === window.uuid && !tab.pinned) || !tab.hasAttribute('zen-workspace-id')) { if (!firstTab) { firstTab = tab; - gBrowser.selectedTab = firstTab; + } else if (gBrowser.selectedTab === tab) { + // If the selected tab is already in the workspace, we don't want to change it + firstTab = undefined; } gBrowser.showTab(tab); if (!tab.hasAttribute('zen-workspace-id')) { @@ -467,6 +469,9 @@ var ZenWorkspaces = { } } } + if (firstTab) { + gBrowser.selectedTab = firstTab; + } if (typeof firstTab === 'undefined' && !onInit) { this._createNewTabForWorkspace(window); }