From a8e245b28a01edf352619b25278224211ddca567 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Thu, 19 Feb 2026 00:50:11 +0100 Subject: [PATCH] feat: Listen for tabHide and tabShow events for window sync, b=bug #12408, c=no-component --- src/zen/sessionstore/ZenWindowSync.sys.mjs | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/zen/sessionstore/ZenWindowSync.sys.mjs b/src/zen/sessionstore/ZenWindowSync.sys.mjs index f825ef4e8..fd27cba8a 100644 --- a/src/zen/sessionstore/ZenWindowSync.sys.mjs +++ b/src/zen/sessionstore/ZenWindowSync.sys.mjs @@ -47,6 +47,9 @@ const EVENTS = [ "TabGroupRemoved", "TabGroupMoved", + "TabHide", + "TabShow", + "ZenTabRemovedFromSplit", "ZenSplitViewTabsSplit", @@ -1167,6 +1170,34 @@ class nsZenWindowSync { return this.#delegateGenericSyncEvent(aEvent, SYNC_FLAG_LABEL); } + on_TabHide(aEvent) { + const tab = aEvent.target; + const window = tab.ownerGlobal; + if (lazy.gSyncOnlyPinnedTabs && !tab.pinned) { + return; + } + this.#runOnAllWindows(window, (win) => { + const targetTab = this.getItemFromWindow(win, tab.id); + if (targetTab) { + targetTab.ownerGlobal.gBrowser.hideTab(targetTab); + } + }); + } + + on_TabShow(aEvent) { + const tab = aEvent.target; + const window = tab.ownerGlobal; + if (lazy.gSyncOnlyPinnedTabs && !tab.pinned) { + return; + } + this.#runOnAllWindows(window, (win) => { + const targetTab = this.getItemFromWindow(win, tab.id); + if (targetTab) { + targetTab.ownerGlobal.gBrowser.showTab(targetTab); + } + }); + } + on_TabMove(aEvent) { this.#delegateGenericSyncEvent(aEvent, SYNC_FLAG_MOVE); return Promise.resolve();