Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion prefs/zen/workspaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
- name: zen.workspaces.scroll-modifier-key
value: ctrl

- name: services.sync.engine.workspaces
- name: services.sync.engine.sidebarsync
value: true

- name: services.sync.engine.sidebarsync.modified
value: false

- name: zen.workspaces.separate-essentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ index 64aa0d98a0622c01f3dcfff1a04bfcda368354d2..2013e04b0881ad2295d6897b91e1573c
{ id: "services.sync.engine.passwords", type: "bool" },
{ id: "services.sync.engine.addresses", type: "bool" },
{ id: "services.sync.engine.creditcards", type: "bool" },
+ { id: "services.sync.engine.workspaces", type: "bool" },
+ { id: "services.sync.engine.sidebarsync", type: "bool" },
]);

let gSyncChooseWhatToSync = {
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ index ef127a1bc2e3ea4221b641156c38a74edb3b44ae..acd39fe7f6dc7ec03ea50928e2d00279
+ <html:div class="sync-engine-workspaces">
+ <checkbox
+ data-l10n-id="sync-engine-workspaces"
+ preference="services.sync.engine.workspaces"
+ preference="services.sync.engine.sidebarsync"
+ />
+ </html:div>
</html:div>
Expand Down
2 changes: 1 addition & 1 deletion src/browser/components/preferences/sync-inc-xhtml.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ index 4ecdbdb129577165ed0df619577327f7610e138f..761a4d4f26a21ba555b7af180e8a6030
<image class="sync-engine-image sync-engine-prefs" alt=""/>
<label data-l10n-id="sync-currently-syncing-settings"/>
</html:div>
+ <html:div engine_preference="services.sync.engine.workspaces">
+ <html:div engine_preference="services.sync.engine.sidebarsync">
+ <image class="sync-engine-image sync-engine-workspaces" alt=""/>
+ <label data-l10n-id="sync-currently-syncing-workspaces"/>
+ </html:div>
Expand Down
14 changes: 14 additions & 0 deletions src/services/sync/modules/service-sys-mjs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/services/sync/modules/service.sys.mjs b/services/sync/modules/service.sys.mjs
--- a/services/sync/modules/service.sys.mjs
+++ b/services/sync/modules/service.sys.mjs
@@ -80,6 +80,10 @@ function getEngineModules() {
result.Form = { module: "forms.sys.mjs", symbol: "FormEngine" };
result.History = { module: "history.sys.mjs", symbol: "HistoryEngine" };
result.Tab = { module: "tabs.sys.mjs", symbol: "TabEngine" };
+ result.SidebarSync = {
+ module: "resource:///modules/zen/ZenSidebarSync.sys.mjs",
+ symbol: "SidebarSyncEngine",
+ };
}
if (Svc.PrefBranch.getBoolPref("engine.addresses.available", false)) {
result.Addresses = {
1 change: 1 addition & 0 deletions src/zen/folders/ZenFolders.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class nsZenFolders extends nsZenDOMOperatedFeature {
window.addEventListener("FolderUngrouped", this);
window.addEventListener("TabSelect", this);
window.addEventListener("TabOpen", this);
window.addEventListener("ZenFolderRenamed", this);
const onNewFolder = this.#onNewFolder.bind(this);
document.getElementById("zen-context-menu-new-folder").addEventListener("command", onNewFolder);
document
Expand Down
7 changes: 4 additions & 3 deletions src/zen/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ DIRS += [
"drag-and-drop",
"glance",
"mods",
"tests",
"urlbar",
"toolkit",
"sessionstore",
"share",
"sync",
"tests",
"toolkit",
"urlbar",
]
51 changes: 48 additions & 3 deletions src/zen/sessionstore/ZenWindowSync.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const EVENTS = [
"TabGroupRemoved",
"TabGroupMoved",

"ZenFolderRenamed",
"ZenTabRemovedFromSplit",
"ZenSplitViewTabsSplit",

Expand Down Expand Up @@ -1002,6 +1003,15 @@ class nsZenWindowSync {
});
}

/**
* Notifies the sidebar sync engine that data has changed.
*
* @param {string} aType - The type of change: "workspaces", "folders", or "pinned-tabs"
*/
notifySidebarSyncChange(aType) {
Services.obs.notifyObservers(null, `zen-${aType}-changed`);
}

/**
* Propagates the workspaces to all windows.
*
Expand All @@ -1011,6 +1021,7 @@ class nsZenWindowSync {
this.#runOnAllWindows(null, (win) => {
win.gZenWorkspaces.propagateWorkspaces(aWorkspaces);
});
this.notifySidebarSyncChange("workspaces");
}

/**
Expand Down Expand Up @@ -1108,16 +1119,26 @@ class nsZenWindowSync {
}

on_ZenTabIconChanged(aEvent) {
if (!aEvent.target?._zenContentsVisible) {
const tab = aEvent.target;
// Notify sidebar sync for pinned/essential tabs (before cross-window sync check)
if (tab.pinned || tab.hasAttribute("zen-essential")) {
this.notifySidebarSyncChange("pinned-tabs");
}
if (!tab?._zenContentsVisible) {
// No need to sync icon changes for tabs that aren't active in this window.
return;
}
this.#maybeEditAllTabsEntryImage(aEvent.target);
this.#maybeEditAllTabsEntryImage(tab);
return this.#delegateGenericSyncEvent(aEvent, SYNC_FLAG_ICON);
}

on_ZenTabLabelChanged(aEvent) {
if (!aEvent.target?._zenContentsVisible) {
const tab = aEvent.target;
// Notify sidebar sync for pinned/essential tabs (before cross-window sync check)
if (tab.pinned || tab.hasAttribute("zen-essential")) {
this.notifySidebarSyncChange("pinned-tabs");
}
if (!tab?._zenContentsVisible) {
// No need to sync label changes for tabs that aren't active in this window.
return;
}
Expand All @@ -1137,6 +1158,7 @@ class nsZenWindowSync {
if (!tab._zenPinnedInitialState) {
tabStatePromise = this.setPinnedTabState(tab);
}
this.notifySidebarSyncChange("pinned-tabs");
return Promise.all([tabStatePromise, this.on_TabMove(aEvent)]);
}

Expand All @@ -1148,14 +1170,17 @@ class nsZenWindowSync {
delete targetTab._zenPinnedInitialState;
}
});
this.notifySidebarSyncChange("pinned-tabs");
return this.on_TabMove(aEvent);
}

on_TabAddedToEssentials(aEvent) {
this.notifySidebarSyncChange("pinned-tabs");
return this.on_TabMove(aEvent);
}

on_TabRemovedFromEssentials(aEvent) {
this.notifySidebarSyncChange("pinned-tabs");
return this.on_TabMove(aEvent);
}

Expand Down Expand Up @@ -1273,11 +1298,15 @@ class nsZenWindowSync {
SYNC_FLAG_ICON | SYNC_FLAG_LABEL | SYNC_FLAG_MOVE
);
});
if (isFolder) {
this.notifySidebarSyncChange("folders");
}
}

on_TabGroupRemoved(aEvent) {
const tabGroup = aEvent.target;
const window = tabGroup.ownerGlobal;
const isFolder = tabGroup.isZenFolder;
this.#runOnAllWindows(window, (win) => {
const targetGroup = this.getItemFromWindow(win, tabGroup.id);
if (targetGroup) {
Expand All @@ -1288,16 +1317,32 @@ class nsZenWindowSync {
}
}
});
if (isFolder) {
this.notifySidebarSyncChange("folders");
}
}

on_TabGroupMoved(aEvent) {
const tabGroup = aEvent.target;
if (tabGroup.isZenFolder) {
this.notifySidebarSyncChange("folders");
}
return this.on_TabMove(aEvent);
}

on_TabGroupUpdate(aEvent) {
const tabGroup = aEvent.target;
if (tabGroup.isZenFolder) {
this.notifySidebarSyncChange("folders");
}
return this.#delegateGenericSyncEvent(aEvent, SYNC_FLAG_ICON | SYNC_FLAG_LABEL);
}

on_ZenFolderRenamed(aEvent) {
this.notifySidebarSyncChange("folders");
return this.#delegateGenericSyncEvent(aEvent, SYNC_FLAG_LABEL);
}

on_ZenTabRemovedFromSplit(aEvent) {
const tab = aEvent.target;
const window = tab.ownerGlobal;
Expand Down
Loading
Loading