Skip to content
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

Monitor app.focus() regressions #102997

Closed
bpasero opened this issue Jul 21, 2020 · 1 comment
Closed

Monitor app.focus() regressions #102997

bpasero opened this issue Jul 21, 2020 · 1 comment
Assignees
Labels
workbench-electron Electron-VS Code issues
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Jul 21, 2020

I ended up only using app.focus({ steal: true }) in one place: where a second instance from the command line talks to the first instance:

I was really not sure about other users of BrowserWindow.focus() so instead of blindingly adding app.focus, I would wait for regression reports from users.

It seems quite obvious to me that we would want app.focus({ steal: true }) everywhere where VSCode is possibly not in the foreground and some action triggers it:

  • a second invocation from command line (this is covered)
  • URL handlers (e.g. from a browser)
  • a debug breakpoint (there is a setting in debug to focus window on breakpoint hit)
  • drag and drop from other applications
  • interacting with the macOS Dock

Some thoughts:

  • it is unclear to me what app.focus means on Windows and Linux where imho we do not need to call this method at all
  • should we only call this on macOS only?
  • the URL handler is another potential candidate of this, but I was not sure if the application would already get focus for free when a URL is handled (e.g. this can happen when VSCode is launched from a web browser)
  • we possibly need to fix debug to force focus when a breakpoint is hit
  • unclear to me if interacting with DND is now broken
  • unclear to me if interacting with dock is now broken
@bpasero
Copy link
Member Author

bpasero commented Sep 2, 2020

Pushed 29ca95b to address 2 things:

As a consequence, methods for Window.focus() now have an option force: boolean to enable app.focus({ steal: true}), but we only use this on macOS where we know the flow is broken from the Electron update.

@bpasero bpasero closed this as completed Sep 2, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
workbench-electron Electron-VS Code issues
Projects
None yet
Development

No branches or pull requests

2 participants