File tree Expand file tree Collapse file tree
platform/launch/electron-main Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
338338 }
339339
340340 focus ( options ?: { force : boolean } ) : void {
341- // macOS: Electron >6 .x changed its behaviour to not
341+ // macOS: Electron > 7 .x changed its behaviour to not
342342 // bring the application to the foreground when a window
343343 // is focused programmatically. Only via `app.focus` and
344344 // the option `steal: true` can you get the previous
Original file line number Diff line number Diff line change @@ -73,10 +73,18 @@ export class LaunchMainService implements ILaunchMainService {
7373 async start ( args : NativeParsedArgs , userEnv : IProcessEnvironment ) : Promise < void > {
7474 this . logService . trace ( 'Received data from other instance: ' , args , userEnv ) ;
7575
76- // Since we now start to open a window, make sure the app has focus.
77- // Focussing a window will not ensure that the application itself
78- // has focus, so we use the `steal: true` hint to force focus.
79- app . focus ( { steal : true } ) ;
76+ // macOS: Electron > 7.x changed its behaviour to not
77+ // bring the application to the foreground when a window
78+ // is focused programmatically. Only via `app.focus` and
79+ // the option `steal: true` can you get the previous
80+ // behaviour back. The only reason to use this option is
81+ // when a window is getting focused while the application
82+ // is not in the foreground and since we got instructed
83+ // to open a new window from another instance, we ensure
84+ // that the app has focus.
85+ if ( isMacintosh ) {
86+ app . focus ( { steal : true } ) ;
87+ }
8088
8189 // Check early for open-url which is handled in URL service
8290 const urlsToOpen = parseOpenUrl ( args ) ;
You can’t perform that action at this time.
0 commit comments