From 46c0393a24c5ad660f6ca8fcdb7b72f7e14878fe Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sun, 22 Nov 2015 10:41:14 +0100 Subject: [PATCH] try workaround for not being able to focus window on win & linux --- src/vs/workbench/electron-browser/window.ts | 6 +++++- src/vs/workbench/electron-main/window.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts index a82898ad10f..89755c55e64 100644 --- a/src/vs/workbench/electron-browser/window.ts +++ b/src/vs/workbench/electron-browser/window.ts @@ -174,7 +174,11 @@ export class ElectronWindow { public focus(): void { if (!this.win.isFocused()) { - this.win.focus(); + if (platform.isWindows || platform.isLinux) { + this.win.show(); // Windows & Linux sometimes cannot bring the window to the front when it is in the background + } else { + this.win.focus(); + } } } diff --git a/src/vs/workbench/electron-main/window.ts b/src/vs/workbench/electron-main/window.ts index b7d003c2f39..c924a897af2 100644 --- a/src/vs/workbench/electron-main/window.ts +++ b/src/vs/workbench/electron-main/window.ts @@ -215,7 +215,11 @@ export class VSCodeWindow { this._win.restore(); } - this._win.focus(); + if (platform.isWindows || platform.isLinux) { + this._win.show(); // Windows & Linux sometimes cannot bring the window to the front when it is in the background + } else { + this._win.focus(); + } } public get lastFocusTime(): number { -- GitLab