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();