Skip to content

Workspaces sync [2.0]#12531

Draft
kristijanribaric wants to merge 6 commits intozen-browser:devfrom
kristijanribaric:zen-sync
Draft

Workspaces sync [2.0]#12531
kristijanribaric wants to merge 6 commits intozen-browser:devfrom
kristijanribaric:zen-sync

Conversation

@kristijanribaric
Copy link
Member

@kristijanribaric kristijanribaric commented Feb 26, 2026

A new sync implementation built on top of Firefox's existing Sync infrastructure, enabling cross-device synchronization of workspaces, containers, pinned tabs, and folders, reworked from the ground up.

What syncs

  • Workspaces: name, icon, theme, assigned container
  • Containers: identity, color, icon
  • Pinned tabs & essentials & regular tabs: URL, title, icon, workspace/folder assignment
  • Folders : label, icon, position, workspace assignment

Changes

  • New sync engine : added ZenWorkspacesStore, ZenWorkspacesTracker, and ZenWorkspacesEngine to manage tracking and storing workspace changes across devices
  • Session merge logic : modified ZenSessionManager to properly merge incoming remote data with the local session
  • Container ID sync : patched ContextualIdentityService.sys.mjs to allow creating containers with an explicit ID, ensuring pinned tabs and workspaces reference the correct container across devices
  • Engine registration: patched service.sys.mjs to register the new workspace sync engine

While overall sync works, it needs further testing and refinement, thx

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Feature labels Feb 26, 2026
EXTRA_JS_MODULES.zen += [
"ZenSessionManager.sys.mjs",
"ZenWindowSync.sys.mjs",
"ZenWorkspacesSync.sys.mjs",
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it should be moved to its own "../sync" directory?

@azizkoumenji
Copy link

Can you also add sync support for Zen Mods if possible?

@kristijanribaric
Copy link
Member Author

Can you also add sync support for Zen Mods if possible?

Not in scope of this PR.
Once workspace sync is all done and stable, we can start implementing separate sync mechanism for mods.

@azizkoumenji
Copy link

Will unpinned tabs be synced in the future?

@mr-cheffy
Copy link
Member

They should be with this PR

@MaximilianZenz
Copy link

that there are now two competing PRs of the same feature shows pretty clear how important this feature is. i hope this will get merged soon. Have you looked at the code from the other guy? maybe he has some solutions for the issue you still have. syncing only on restart seems kinda weird as many people (at least the ones i know) never restart their browsers ever.

@mr-cheffy
Copy link
Member

We want it to be live syncing, so don't worry about that, this is just a POC. There are some main blockers though because we are not sure how the merging mechanism should work. Should it completely override? Merge both sessions? ...

@mirai-toto
Copy link

We want it to be live syncing, so don't worry about that, this is just a POC. There are some main blockers though because we are not sure how the merging mechanism should work. Should it completely override? Merge both sessions? ...

My two cents: just prompt the user when there's a conflict, like Steam does

@mr-cheffy mr-cheffy mentioned this pull request Mar 9, 2026
5 tasks
@SilverEzhik
Copy link

We want it to be live syncing, so don't worry about that, this is just a POC. There are some main blockers though because we are not sure how the merging mechanism should work. Should it completely override? Merge both sessions? ...

I would love for it to be treated as just one session - as if all Zen windows on all of my computers belong to the same browser profile, have the same tabs, etc.

I imagine sync can get very complex, though. Perhaps failures would be more forgiving if there was a way to easily recover - if some other device closed 100 tabs, there should be a way to recover them with a shortcut like Cmd+Shift+T.

@UnnaturalTwilight
Copy link

On the matter of unpinned tabs, please have that be a separatly configurable sync item from workspaces & pined tabs if it is reasonable to implement as such.

I personally wouldn't want my unpinned tabs syncing automatically since my primary use for sync is between windows and Linux on the same device. I tend to have very different sets of tabs between the two and would just end up closing all the synced tabs anyways. For the few cases where I want an unpinned tabs to move between them I would just use the send to device feature like I currently do.

If they aren't separate it isn't a deal breaker for me but I would appreciate not having the extra overhead if I can avoid it.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Mar 11, 2026
@mr-cheffy mr-cheffy marked this pull request as draft March 11, 2026 19:50
@mr-cheffy
Copy link
Member

Please mark it as ready for review once its done! There seems to be git conflicts as well?

- syncs workspaces, containers, pinned tabs, essentials and regular tabs. Keeps local "state" of sync that is then compared with the incoming changes and then tries to combine the two. While this enables full session sync in realtime, it's rough and buggy and needs further polishing
Replace single-record syncMeta with per-item hash snapshots and
multi-record sync. Simplifies conflict resolution by delegating to
Firefox Sync's record-level logic. Updates tracker to monitor individual
item changes via "zen-workspace-item-changed" notifications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants