-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Browser Bridge: new windows steal focus on macOS (should use tabs instead) #739
Copy link
Copy link
Open
Description
Problem
The Browser Bridge extension creates new Chrome windows (chrome.windows.create) for each automation workspace. On macOS, every new window steals focus from the user's active application, making the computer unusable during automated scans.
Current behavior
- Each
openclicommand triggersgetAutomationWindow()in the extension'sbackground.js - If no existing session for the workspace, it calls
chrome.windows.create({ focused: false, ... }) - macOS ignores
focused: false— the new window always activates and comes to front - Different
OPENCLI_CDP_TARGETvalues create separate workspaces, each spawning its own window - Windows idle-timeout after 30s (
WINDOW_IDLE_TIMEOUT), so repeated scans keep creating/destroying windows
Impact
When running batch scans (e.g., 146 restaurants across tabelog/omakase/tablecheck), the user experiences:
- Constant window pop-ups stealing keyboard/mouse focus
- Inability to use other applications during the ~60 min scan
- Chrome windows flashing on screen every few seconds
Attempted workarounds (all insufficient)
| Approach | Result |
|---|---|
focused: false |
macOS ignores this for new windows |
state: "minimized" in create() |
Conflicts with focused/width/height params |
chrome.windows.update(id, {state:"minimized"}) after create |
Works but window still flashes briefly on main screen |
left: -9999 (off-screen) |
Chrome rejects: "Bounds must be at least 50% within visible screen space" |
| Move to secondary monitor after create | Works but still flashes on primary screen first |
--window-position Chrome flag |
Ignored by Google Chrome (only works in Chromium) |
Suggested fix
Follow the pattern used by the Claude in Chrome extension:
- Use tabs within an existing window (
chrome.tabs.create) instead of new windows (chrome.windows.create) - Optionally use a tab group to isolate automation tabs
- This avoids the macOS focus-stealing issue entirely, since new tabs don't activate the window
Minimal code change suggestion
In the extension's background.js, getAutomationWindow():
// Instead of:
const win = await chrome.windows.create({ url: BLANK_PAGE, ... });
// Consider:
// Reuse the existing Chrome window, create a tab in it
const [existingWindow] = await chrome.windows.getAll({ windowTypes: ['normal'] });
const tab = await chrome.tabs.create({
windowId: existingWindow.id,
url: BLANK_PAGE,
active: false // this actually works for tabs, unlike focused:false for windows
});Environment
- macOS 15 (Darwin 25.3.0)
- Google Chrome 146.0.7680.178
- opencli v1.6.1, extension v1.5.5
- Dual monitor setup (Studio Display + DELL S2722QC)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels