From db4823523376bfc56291ea37c475197bb2201fd3 Mon Sep 17 00:00:00 2001 From: Tereza Tomcova Date: Mon, 3 Apr 2017 08:47:14 +0200 Subject: [PATCH] Set relaunch command for window (for #13905) --- src/typings/electron.d.ts | 12 ++++++++++++ src/vs/code/electron-main/window.ts | 11 ++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/typings/electron.d.ts b/src/typings/electron.d.ts index ab5d7d9b830..78cfe852412 100644 --- a/src/typings/electron.d.ts +++ b/src/typings/electron.d.ts @@ -1318,6 +1318,18 @@ declare namespace Electron { * Note: This API is available only on Windows. */ setThumbnailToolTip(toolTip: string): boolean; + /** + * Sets the application id, app icon, relaunch command and relaunch display name + * for the given window. appIconIndex should be set to 0 if the app icon + * file only has a single icon. + */ + setAppDetails(options: { + appId?: string; + appIconPath?: string; + appIconIndex?: number; + relaunchCommand?: string; + relaunchDisplayName?: string; + }): void; /** * Same as webContents.showDefinitionForSelection(). * Note: This API is available only on macOS. diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index cab7c549896..8403a71a91a 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -219,6 +219,15 @@ export class VSCodeWindow { this._win.setSheetOffset(22); // offset dialogs by the height of the custom title bar if we have any } + // Set relaunch command + if (platform.isWindows && product.win32AppUserModelId && typeof this._win.setAppDetails === 'function') { + this._win.setAppDetails({ + appId: product.win32AppUserModelId, + relaunchCommand: `"${process.execPath}" -n`, + relaunchDisplayName: product.nameLong + }); + } + if (isFullscreenOrMaximized) { this.win.maximize(); @@ -769,4 +778,4 @@ export class VSCodeWindow { this._win = null; // Important to dereference the window object to allow for GC } -} +} \ No newline at end of file