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
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.

2 participants