Refactor ZenWorkspaces to enhance tab switching logic with asynchronous handling for improved workspace management

This commit is contained in:
mr. M
2025-02-22 20:59:08 +01:00
parent cc0e18012d
commit 7819b561ad
2 changed files with 19 additions and 14 deletions

View File

@@ -2273,10 +2273,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
switchIfNeeded(browser) {
const tab = gBrowser.getTabForBrowser(browser);
const workspaceId = tab.getAttribute('zen-workspace-id');
if (!tab.hasAttribute('zen-essential') && workspaceId !== this.activeWorkspace) {
this.changeWorkspace({ uuid: workspaceId });
}
return new Promise(async(resolve) => {
const tab = gBrowser.getTabForBrowser(browser);
const workspaceId = tab.getAttribute('zen-workspace-id');
if (!tab.hasAttribute('zen-essential') && workspaceId !== this.activeWorkspace) {
await this.changeWorkspace({ uuid: workspaceId });
}
resolve();
});
}
})();