Skip to content

Conversation

@bdbch
Copy link
Contributor

@bdbch bdbch commented Jan 27, 2026

This adds a new Firefox Sync engine that syncs:

  • Workspaces (name, icon, theme, container associations)
  • Pinned tabs and essential tabs (URLs, custom labels, positions)
  • Folders with full nesting support and custom icons

The sync is enabled by default when Firefox Sync is active. It uses a single-record approach similar to the Prefs engine, with last-writer-wins conflict resolution.

Key things:

  • Tabs sync as lazy (don't load until clicked)
  • Custom tab labels are preserved
  • Folder icons sync correctly
  • Interleaved ordering of tabs/folders is maintained
  • Essential tabs sync to the essentials container (workspace-independent)
  • Safety checks prevent empty/stale data from overwriting good data

The engine triggers sync on workspace changes, folder changes, pinned tab changes, tab moves, and folder icon updates.

@bdbch bdbch requested a review from mr-cheffy as a code owner January 27, 2026 00:30
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Feature labels Jan 27, 2026

// Notify sync engine if pinned/essential tab was moved to folder
if (group.isZenFolder && (tab.pinned || tab.hasAttribute("zen-essential"))) {
Services.obs.notifyObservers(null, "zen-pinned-tabs-changed");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These notifiers should be called from ZenWindowSync imo

window.dispatchEvent(new CustomEvent("ZenWorkspaceDataChanged"), { bubbles: true });
window.gZenWindowSync.propagateWorkspacesToAllWindows(aSpaceData ?? this._workspaceCache);
// Notify sync engine of workspace changes
Services.obs.notifyObservers(null, "zen-workspaces-changed");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also call from the WindowSync manager

// Only notify sync engine if tab is being unpinned, not closed
// When a tab is closing, it will be removed anyway, no need to sync
if (!tab.closing) {
Services.obs.notifyObservers(null, "zen-pinned-tabs-changed");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also call from the WindowSync manager

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 27, 2026
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jan 27, 2026
@A2va
Copy link

A2va commented Jan 28, 2026

Does it also sync the containers linked to a workspace ?

@bdbch
Copy link
Contributor Author

bdbch commented Jan 28, 2026

Does it also sync the containers linked to a workspace ?

Not sure, would have to double verify. Right now I'm stuck with stabilizing the sync. It's not ready yet for use but from my last test I'm sure the container ID at least is synced. The more interesting question would be how to make sure specific containers are belonging to each other cross device.

@TheReyzer
Copy link

I hope it came soon. just waiting this for change from Arc Browser.

@bdbch
Copy link
Contributor Author

bdbch commented Jan 31, 2026

I will try to get some time to work on this. Last week was very busy. Since this is my first time working on Firefox & Sync Engines directly I want to make sure this 100% works.

With my last changes I made I was able to get tabs synced but workspace changes very often were delayed or overwritten by different clients.

I will work on this today or tomorrow and try to find a solution that is stable.

@TheReyzer
Copy link

I will try to get some time to work on this. Last week was very busy. Since this is my first time working on Firefox & Sync Engines directly I want to make sure this 100% works.

With my last changes I made I was able to get tabs synced but workspace changes very often were delayed or overwritten by different clients.

I will work on this today or tomorrow and try to find a solution that is stable.

Hope you get it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants