Skip to content

feat: Add Air Traffic Control for automatic link routing to workspaces, b=no-bug, c=workspaces#9042

Closed
meenie wants to merge 0 commit intozen-browser:devfrom
meenie:add-air-traffic-control
Closed

feat: Add Air Traffic Control for automatic link routing to workspaces, b=no-bug, c=workspaces#9042
meenie wants to merge 0 commit intozen-browser:devfrom
meenie:add-air-traffic-control

Conversation

@meenie
Copy link
Copy Markdown

@meenie meenie commented Jun 16, 2025

Air Traffic Control – Automatic External-Link Routing

I’ve been itching to move from Arc Browser to Zen for daily work, but I couldn’t live without Arc’s Air Traffic Control feature, so I decided to add it to Zen.
This is my very first contribution to the project, so please excuse any mistakes.


What’s inside ?

Area File(s) Purpose
Core engine src/zen/modules/ZenAirTrafficControl.mjs Stores routing rules, persists them to prefs, and decides which workspace a URL belongs in.
Browser glue src/zen/modules/ZenAirTrafficControlIntegration.mjs Hooks BrowserDOMWindow.openURI, asks the engine, then opens/relocates the tab in the right workspace.
Preferences UI browser/components/preferences/zen-air-traffic-control.{xhtml,js,css} Lets users add / edit / disable rules from Settings.

How it works

  1. Rule definition
    Users will create patterns (e.g. *.github.com, */jira/*) in the Preferences UI.
  2. Engine decision
    ZenAirTrafficControl.routeURL() returns { workspaceId } when a rule matches.
  3. Tab handling
    The integration layer intercepts the external open, creates the tab, and moves it to the workspace – all in the same window, so no flash-of-new-window.

Performance note – the integration keeps a small “duplicate-URL” throttle to avoid processing the same link twice in a second.


Screenshots

Main interface. I added it to the Tab Management section of Preferences
image

When importing, you can map routes from one workspace to another.
image


Missing Things

Localization (l10n)

Localized strings are not yet wired up; I'm actually not sure how that process works.

Documentation

I'll create a PR in https://github.com/zen-browser/docs if/when this PR is merged.

@meenie meenie requested a review from mr-cheffy June 16, 2025 06:00
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Feature labels Jun 16, 2025
@meenie meenie force-pushed the add-air-traffic-control branch 3 times, most recently from ff9e5de to b8ca114 Compare June 16, 2025 07:44
Copy link
Copy Markdown
Member

@mr-cheffy mr-cheffy left a comment

Choose a reason for hiding this comment

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

It all looks pretty awesome!

Only thing im requesting is; please move all the settings into dialogs on the top window as we are trying to move away from it.

So, for example, create a dialog to manage all the rules and once done just remove it from the DOM, that should be enough.

And please run npm run pretty for format the project

Looks really cool, cant wait to use it myself!

Comment thread src/browser/base/content/zen-assets.jar.inc.mn Outdated
content/browser/preferences/widgets/setting-group.css (widgets/setting-group/setting-group.css)
+
+ content/browser/preferences/zen-settings.js
+ content/browser/preferences/zen-air-traffic-control.js
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we please have all these settings in the parent window as a dialog? Trying to avoid the preferences page as much as possible.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think a need a little bit more clarity. Where should I put the affordance that would open up the dialog? Do you have an example where you've already done this in Zen?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@meenie unfortunately, I can't think of an example where we are currently doing this on zen.

But it would ideally just be the same XHTML contents but instead of being in the settings, it's opened via https://searchfox.org/mozilla-central/source/browser/base/content/browser.js#5250.

One example of this modal is when pressing CMD+Q on mac

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ya, for sure, makes sense. Just wondering where I should put the button to open it up? Should it be in a context menu somewhere? Or put a button in the preferences area that opens it up, kinda like how Arc does it themselves?
image

image

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe here? @marat0n

image

Also, please ping me so I can know you wrote me

Comment thread src/browser/modules/BrowserDOMWindow-sys-mjs.patch Outdated
Comment thread src/browser/modules/BrowserDOMWindow-sys-mjs.patch Outdated
Comment thread src/zen/workspaces/ZenWorkspaces.mjs Outdated
Comment thread src/zen/modules/ZenAirTrafficControl.mjs Outdated
@meenie meenie force-pushed the add-air-traffic-control branch from 153b5f8 to 4a1216d Compare June 16, 2025 17:09
@meenie
Copy link
Copy Markdown
Author

meenie commented Jun 16, 2025

BTW, @mauro-balades, there's a bug with the tests where I'm getting FAIL A promise chain failed to handle a rejection: [fluent] Missing message in locale en-US: category-zen-marketplace - stack: (No stack available.). There's a missing translation for a tooltip. To get past that, I hacked that xhtml file to use a different translation. I tried manually adding one to the en-US fluent file but it didn't seem to work. Need some guidance what I should do.

@mr-cheffy
Copy link
Copy Markdown
Member

Should be just a warning, no?

Comment thread src/browser/components/preferences/zenTabsManagement.inc.xhtml Outdated
@meenie
Copy link
Copy Markdown
Author

meenie commented Jun 16, 2025

Should be just a warning, no?

It actually fails the run. For example:
image

@ghost
Copy link
Copy Markdown

ghost commented Jun 16, 2025

@meenie in that case, if you are going to make a PR for l10n packs, also add this one 🙏🏽

@mr-cheffy
Copy link
Copy Markdown
Member

@meenie how is it going? Need help with anything?

@meenie
Copy link
Copy Markdown
Author

meenie commented Jun 22, 2025

@mr-cheffy, sorry, work has been busy :). I'll try and finish this up to today. I see you pinged another person asking about adding the affordance to open up the ATC model in the context menu but haven't heard back yet. I'll go ahead and make the change as it's pretty easy to change again.

@mr-cheffy
Copy link
Copy Markdown
Member

Oh.. I misread the names 😅

Thanks a lot for such incredible amounts of patience and a great feature being introduced

@A2va
Copy link
Copy Markdown

A2va commented Jun 22, 2025

Just a quick question, are there any plans to implement synchronization (as with workspaces) in this PR? Or will it be done in another PR?
In any case, thanks for adding this feature.

@mr-cheffy
Copy link
Copy Markdown
Member

In a separate pr imo would be better. Also, @meenie could we please call it 'Control Flow'? You know.. in order to not have the same names

@itsyaasir
Copy link
Copy Markdown

Nice, that this is coming as a native feature, I specifically developed an extension for this found here.

Good work!

@Propheticus
Copy link
Copy Markdown

Propheticus commented Jun 27, 2025

Just a quick check: what happens when an external link is routed to a workspace with default container A, but within Zen links to that domain have been configured to open in container B (e.g. using the widely used Firefox multi-account containers extension) ?
especially combined with this option:
image

@meenie
Copy link
Copy Markdown
Author

meenie commented Jun 27, 2025

@Propheticus, that is a very good question... I don't normally use Firefox so I wasn't aware of this. I will look into it!

Sorry all for the delay. My regular work has been rather all-consuming. I plan on finishing this up this weekend!

@12th-devs
Copy link
Copy Markdown
Contributor

@meenie I just wanted to come check on this PR. How is it coming along locally?

@meenie
Copy link
Copy Markdown
Author

meenie commented Jul 7, 2025

I worked on it this weekend and almost finished. It took me a long time to figure out how to get the dialog stuff working. I need to fix the e2e tests and an issue with the dialog box opening up with a random width that for the life of me I can't figure out how to change lol.

Again, sorry for the delay but it's coming very soon!

Here's a sneak preview:

Context Menu Item
image

The new settings dialog
image

@12th-devs
Copy link
Copy Markdown
Contributor

Looking great! Is the control flow thing an actual window or just created to look like one?

@meenie
Copy link
Copy Markdown
Author

meenie commented Jul 7, 2025

@Anoms12, it's an actual window. Using openDialog. I did look into using the same modal as the one that shows when you do cmd+q, but it was too limiting and ran into even more issues. This was a more encapsulated approach.

@12th-devs
Copy link
Copy Markdown
Contributor

@meenie okay cool! Last question, the text says external applications, so are tabs opened with the URL bar not affected?

@meenie
Copy link
Copy Markdown
Author

meenie commented Jul 7, 2025

@Anoms12, that's correct.

@Propheticus
Copy link
Copy Markdown

This is coming together nicely!

A functional question:

  • Can you define a 'catch all' / default workspace when no rule matches or would that simply be a regex .* rule?
  • Related to that example regex: what happens in case two or more conflicting rules match? Does the rule with the highest specificity win, does the order matter, ...?

@meenie
Copy link
Copy Markdown
Author

meenie commented Jul 7, 2025

@Propheticus, great questions :).

  1. I suppose ya, you could just do .* for a catch-all rule! I do see that Arc does have a default you can configure, though... Looks like I missed something 🤦🏻‍♂️. I'm going to skip that for now and make it a fast follow.
  2. I have not introduced ordering, so the first rule found by creation date (oldest to newest) will be used. That's how it works in Arc and I never ran into an issue with overlapping rules because the sites I route between my person and work profiles never clashed anyway. You could easily add re-ordering to this later on, but I figured it was a bit of a scope creep so decided against it.

@Propheticus
Copy link
Copy Markdown

2. because the sites I route between my person and work profiles never clashed anyway

Agree. I can't imagine a lot of rules would conflict. Better make sure I create that catch all regex last then ;)

@12th-devs
Copy link
Copy Markdown
Contributor

@Anoms12, @meenie is doing this in he's spare time, please don't presume him

@mr-cheffy oh I apologize. Thank you for being willing to tell me I am overstepping.

@mr-cheffy
Copy link
Copy Markdown
Member

Don't worry, I'm just saying it's better to get it right than to get it fast

@12th-devs
Copy link
Copy Markdown
Contributor

12th-devs commented Jul 14, 2025

Don't worry, I'm just saying it's better to get it right than to get it fast

@mr-cheffy I get that. Do you know if we will be able to make changes to the UI to make it fit themes? As it is in a new window

@mr-cheffy
Copy link
Copy Markdown
Member

Not sure about that, sorry. But I think so yes

@sebazelonka
Copy link
Copy Markdown

This is an amazing feature, looking forward to be able to use it! Do you have plans to manage a default value?
I mean, where to open all the links not managed by the specific rules.

@Alespren
Copy link
Copy Markdown

@sebazelonka They discussed this earlier- you can just create a catch-all rule .*. If it's the latest rule created it will be lowest priority so the other rules will match first.

@MiraiDevv
Copy link
Copy Markdown

Guys, is there anything missing from this PR that needs to be merged into the dev branch? Does anyone have any information on this? If I can help with anything, please let me know what's missing so it can be merged.

By the way, @mr-cheffy , if you could put up a to-do list of the things that are still missing and have already been done, and what you think should be added to this specific feature because it might be different from what works in Arc since it's Chrome, I would be very grateful. This would greatly help people who want to contribute to see what's missing according to the to-do list and help develop this feature more quickly.

@mr-cheffy
Copy link
Copy Markdown
Member

Right now I'm full on folders, sorry. This pr is almost complete, last thing needed is the settings page to be converted into a settings popup

@12th-devs
Copy link
Copy Markdown
Contributor

@mr-cheffy I'll make a to do list for the PR in an hour or so. Just add it to the description when you have time

@sebazelonka
Copy link
Copy Markdown

Is there an estimated on when this will be merged?

@nomoderator
Copy link
Copy Markdown

hey @meenie , whenever you get time, can you rebase/resolve conflicts so that this can be tested on Twilight?
I'm eagerly waiting for this feature. Thanks

@MiraiDevv
Copy link
Copy Markdown

hey @meenie , whenever you get time, can you rebase/resolve conflicts so that this can be tested on Twilight? I'm eagerly waiting for this feature. Thanks

Anyone on this github can resolve the conflicts of this PR, it doesn't have to be meenie, he must be busy, it would just be a matter of taking and cloning the specific PR on the machine......if no one does it, I will do it when my new computer arrives, for now I can't.

@alexfazio
Copy link
Copy Markdown

excited for this

@mkhalila
Copy link
Copy Markdown

mkhalila commented Sep 11, 2025

Is this still waiting on merge conflicts being resolved? I can see that after MiraiDevv's request, mr-cheffy resolved the conflicts. After that there wasn't an update on if there's anything else holding this from merge (apart from the more recent merge conflicts since dev has been updated)?

@mr-cheffy
Copy link
Copy Markdown
Member

Just need to finish the settings page, i've been focusing on getting firefox up to date and improving the omnibox actions lately, sorry.

@LemonPotion
Copy link
Copy Markdown

@mr-cheffy, omnibox actions and settings page(if I get it right) are almost done. Do you plan to add this feature soon?

@sebazelonka
Copy link
Copy Markdown

Any pending work for this? I want to start to use it. If I can help please let me know.

@SheepDomination
Copy link
Copy Markdown

What about existing tabs, can Traffic Controller move those or a sequence of tabs to a workspace in one go ?

@zen-browser zen-browser locked as off-topic and limited conversation to collaborators Oct 26, 2025
@zen-browser zen-browser unlocked this conversation Feb 10, 2026
@mr-cheffy mr-cheffy closed this Feb 10, 2026
@mr-cheffy mr-cheffy force-pushed the add-air-traffic-control branch from 55f45c1 to f240fab Compare February 10, 2026 11:15
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Feb 10, 2026
@mr-cheffy
Copy link
Copy Markdown
Member

Whoops, sorry. I was trying to rebase this PR and ended up removing the tree 😅

Doesn't seem to let me push again to this branch

 ! [remote rejected]     add-air-traffic-control -> add-air-traffic-control (permission denied)
error: failed to push some refs to 'https://github.com/meenie/desktop.git'

@mr-cheffy
Copy link
Copy Markdown
Member

I'll move over to #12323 and try to cherry-pick the commits.

@SheepDomination
Copy link
Copy Markdown

Are we to expect this coming to Zen soon, what happened to the original developer or has zen taken it over ?

@23426356587
Copy link
Copy Markdown

Does this mean it's not being implemented!?

@bachjessen
Copy link
Copy Markdown

@23426356587 you should properly go over on #12323. I don't see any indication that it's not coming

@SheepDomination
Copy link
Copy Markdown

Does this mean it's not being implemented!?

It's coming.

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

Labels

Feature size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.