Skip to content

Commit

Permalink
Set relaunch command for window (for #13905)
Browse files Browse the repository at this point in the history
  • Loading branch information
the-ress authored and bpasero committed Apr 3, 2017
1 parent 6f42a23 commit db48235
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/typings/electron.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 10 additions & 1 deletion src/vs/code/electron-main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -769,4 +778,4 @@ export class VSCodeWindow {

this._win = null; // Important to dereference the window object to allow for GC
}
}
}

0 comments on commit db48235

Please sign in to comment.