Skip to content

Fix title bar color inaccuracy on window restore #247773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vishal27shetty
Copy link

Fix title bar color inaccuracy on window restore

The issue

When VS Code is reopened after being closed with multiple windows open, all windows appear with the active title bar color, regardless of their actual focus state. This happens because the styling is applied before the window focus events have properly propagated through the system.

The fix

This PR addresses the issue by:

  1. Assuming all windows are inactive during startup
  2. Using event listeners (focus, blur, mousedown) to determine the actual focus state
  3. Updating the title bar styling once the focus state is properly determined
  4. Including a fallback timeout as a safety net

Testing

  1. Open multiple VS Code windows
  2. Close VS Code while multiple windows are open
  3. Reopen VS Code through a desktop shortcut, Start Menu, or taskbar icon
  4. Observe that only the focused window has the active title bar color, while other windows correctly show the inactive title bar color

Fixes #241405

@vishal27shetty
Copy link
Author

@microsoft-github-policy-service agree

@bpasero bpasero self-assigned this Apr 30, 2025
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.

Window title bar remains in -inFocus color even when multiple windows open at the same time.
3 participants