From 175e38c51b1fbc95291cb52554ca162f2fcd69e4 Mon Sep 17 00:00:00 2001 From: mauro-balades Date: Thu, 29 Aug 2024 21:09:07 +0200 Subject: [PATCH] Fix opening links from external apps --- src/ZenWorkspaces.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ZenWorkspaces.mjs b/src/ZenWorkspaces.mjs index 85f5112..7327c1e 100644 --- a/src/ZenWorkspaces.mjs +++ b/src/ZenWorkspaces.mjs @@ -11,8 +11,8 @@ var ZenWorkspaces = { console.info("ZenWorkspaces: Initializing ZenWorkspaces..."); window.SessionStore.promiseInitialized.then(async () => { await this.initializeWorkspaces(); + console.info("ZenWorkspaces: ZenWorkspaces initialized"); }) - console.info("ZenWorkspaces: ZenWorkspaces initialized"); }, get workspaceEnabled() { @@ -457,12 +457,17 @@ var ZenWorkspaces = { this.unsafeSaveWorkspaces(workspaces); console.info("ZenWorkspaces: Changing workspace to", window.uuid); for (let tab of gBrowser.tabs) { - if (tab.getAttribute("zen-workspace-id") === window.uuid && !tab.pinned) { + if ((tab.getAttribute("zen-workspace-id") === window.uuid && !tab.pinned) || !tab.hasAttribute("zen-workspace-id")) { if (!firstTab) { firstTab = tab; gBrowser.selectedTab = firstTab; } gBrowser.showTab(tab); + if (!tab.hasAttribute("zen-workspace-id")) { + // We add the id to those tabs that got inserted before we initialize the workspaces + // example use case: opening a link from an external app + tab.setAttribute("zen-workspace-id", window.uuid); + } } } if (typeof firstTab === "undefined" && !onInit) {