Skip to content

feat(extension): allow opening background Agent Windows minimized - #748

Merged
NianJiuZst merged 1 commit into
Tencent:mainfrom
MaxFreedomPollard:feat/agent-window-minimized-preference
Nov 20, 2026
Merged

NianJiuZst merged 1 commit into
Tencent:mainfrom
MaxFreedomPollard:feat/agent-window-minimized-preference

Conversation

@MaxFreedomPollard

Copy link
Copy Markdown
Contributor

Fixes #649.

Summary

Even when focusAgentWindowOnOpen is false, chrome.windows.create({ focused: false }) creates a visible window on desktop platforms, flashing into view when new sessions start. This PR adds an opt-in extension preference (openAgentWindowMinimized, default false) to open newly created background Agent Windows in a minimized state while keeping explicit --focus and recording sessions visible.

Changes

  • Preferences & Popup UI: Add openAgentWindowMinimized: boolean (default false) to InteractionPreferences in interaction-preferences.ts, expose a third toggle and scope tooltip under Automation settings in interaction-settings.tsx, and add localized strings across all 10 locales in packages/i18n/src/locales/*/extension.json.
  • Daemon Broadcast Guard: Avoid emitting redundant session.interaction_changed daemon events in background.ts when only extension-local window creation preferences change and the daemon-facing InteractionPolicy (cooperationMode / autoOpenConsoleOnPause) is unchanged.
  • Agent Window Lifecycle: Thread minimized?: boolean through handleSessionStart -> SessionManager.start -> chromeAgentWindowApi.create:
    • When focused is true (for example explicit --focus or record start), minimized is ignored so the window opens visibly.
    • For unsized unfocused windows, pass state: "minimized" directly to chrome.windows.create.
    • Because Chromium's windows.create API rejects combining state: "minimized" with explicit width/height bounds, sized unfocused windows create the window with the requested dimensions first and immediately transition it via chrome.windows.update(win.id, { state: "minimized" }), rolling back with chrome.windows.remove(win.id) if the state update fails.
  • Tests & Changelogs: Add unit coverage in daemon-preferences.test.ts, interaction-settings.test.tsx, agent-window.test.ts, window.test.ts, and human-loop.test.ts, and update CHANGELOG.md and CHANGELOG.zh-CN.md.

Validation

  • pnpm lint
  • pnpm --filter @browser-skill/extension compile
  • pnpm --filter @browser-skill/i18n test
  • pnpm ext:test
  • pnpm ext:build
  • python3 scripts/check-changelog-sync.py "$(git merge-base origin/main HEAD)"

@NianJiuZst NianJiuZst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice, well-thought-out implementation for #649! Keeping openAgentWindowMinimized opt-in (default false), handling Chromium's windows.create constraint by passing state: "minimized" only when unsized and falling back to windows.update with rollback when sized, preserving visible --focus / recording sessions, and avoiding redundant session.interaction_changed broadcasts for extension-local preferences are all clean touches. Full i18n and bilingual changelogs look good and all 12 CI checks are green. LGTM — merging now.

@NianJiuZst
NianJiuZst merged commit ae87b53 into Tencent:main Nov 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: allow Agent Window to be created already minimized (chrome.windows.create state)

2 participants