Fixed workspaces

This commit is contained in:
mauro-balades 2024-09-15 19:20:32 +02:00
parent 64768bd518
commit 329b197bda

View file

@ -490,13 +490,14 @@ var ZenWorkspaces = {
} }
this.unsafeSaveWorkspaces(workspaces); this.unsafeSaveWorkspaces(workspaces);
console.info('ZenWorkspaces: Changing workspace to', window.uuid); console.info('ZenWorkspaces: Changing workspace to', window.uuid);
for (let tab of gBrowser.tabs) { for (let i = 0; i < gBrowser.tabs.length; i++) {
let tab = gBrowser.tabs[i];
if ((tab.getAttribute('zen-workspace-id') === window.uuid && !(tab.pinned && !shouldAllowPinnedTabs)) || !tab.hasAttribute('zen-workspace-id')) { if ((tab.getAttribute('zen-workspace-id') === window.uuid && !(tab.pinned && !shouldAllowPinnedTabs)) || !tab.hasAttribute('zen-workspace-id')) {
if (!firstTab) { if (!firstTab) {
firstTab = tab; firstTab = tab;
} else if (gBrowser.selectedTab === tab) { } else if (gBrowser.selectedTab === tab) {
// If the selected tab is already in the workspace, we don't want to change it // If the selected tab is already in the workspace, we don't want to change it
firstTab = undefined; firstTab = null; // note: Do not add "undefined" here, a new tab would be created
} }
gBrowser.showTab(tab); gBrowser.showTab(tab);
if (!tab.hasAttribute('zen-workspace-id')) { if (!tab.hasAttribute('zen-workspace-id')) {
@ -512,7 +513,8 @@ var ZenWorkspaces = {
if (typeof firstTab === 'undefined' && !onInit) { if (typeof firstTab === 'undefined' && !onInit) {
this._createNewTabForWorkspace(window); this._createNewTabForWorkspace(window);
} }
for (let tab of gBrowser.tabs) { for (let i = 0; i < gBrowser.tabs.length; i++) {
let tab = gBrowser.tabs[i];
if (tab.getAttribute('zen-workspace-id') !== window.uuid) { if (tab.getAttribute('zen-workspace-id') !== window.uuid) {
// FOR UNLOADING TABS: // FOR UNLOADING TABS:
// gBrowser.discardBrowser(tab, true); // gBrowser.discardBrowser(tab, true);