Hi Team,
I'd like to propose a new command-line flag for chrome: `--focus`. I'm writing to ask for guidance on next steps and to get feedback from the community.
Summary:
The --focus flag would allow Chrome users to search and focus existing browser tabs/windows before creating new ones, reducing tab duplication and improving personal scripting workflows.
Background
CL: http://crrev.com/c/6850334 (feature + tests)
Issue: http://crbug.com/439499872 (includes more flag details)
Flag Details
- Flag: --focus=<selector>[,<selector>...]
- Optional: --focus-result-file=<path> for automation feedback
- Behavior: Searches existing tabs/apps using URL patterns or app IDs, focuses most recently used match, optionally opens fallback URL if no matches found
Key Features
- Suffix wildcard matching (https://github.com/*)
- PWA targeting (app:gmail-app-id)
- Most Recently Used (MRU) selection for multiple matches
- Optional JSON result file for programmatic use
- Cross-platform desktop support (Windows, Mac, Linux, ChromeOS)
Use Cases
- Desktop launchers focusing existing content instead of creating duplicates
- Development workflows returning to most recently used repository/document
- Automation scripts that need deterministic tab focusing behavior
Example Usage
- Focus most recent GitHub tab or do nothing
chrome --focus="https://github.com/*"
- Focus Gmail app or most recent Gmail tab, with fallback
chrome --focus="app:gmail-id,https://mail.google.com/*" https://mail.google.com
- With result file for automation
chrome --focus="https://meet.google.com/*" --focus-result-file=/tmp/result.json
Implementation Status
- Core functionality implemented
- Unit and browser test coverage
Questions for Discussion
- What are the next steps needed to get this feature reviewed and potentially landed?
- Are there any concerns about the flag syntax or behavior?
- What additional approvals or design reviews might be needed?
The implementation is ready for review and I'm looking for guidance on the Chrome process for landing new command-line flags.
Thanks,
hjanuschka
--
You received this message because you are subscribed to the Google Groups "flags-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flags-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/flags-dev/CAOmohSLBdjdYbFcHr8HxEZpTFKpVJJMRXamBzN%2Bmjp4rYWHiww%40mail.gmail.com.