diff --git a/resources/linux/code.desktop b/resources/linux/code.desktop index 47ed1616faa..a76cb26ea8a 100644 --- a/resources/linux/code.desktop +++ b/resources/linux/code.desktop @@ -2,7 +2,7 @@ Name=@@NAME_LONG@@ Comment=Code Editing. Redefined. GenericName=Text Editor -Exec=/usr/share/@@NAME@@/@@NAME@@ --new-window-if-not-first %U +Exec=/usr/share/@@NAME@@/@@NAME@@ --unity-launch %U Icon=@@NAME@@ Type=Application StartupNotify=true diff --git a/src/vs/code/electron-main/launch.ts b/src/vs/code/electron-main/launch.ts index 1fe3c4cb558..e69f31b9363 100644 --- a/src/vs/code/electron-main/launch.ts +++ b/src/vs/code/electron-main/launch.ts @@ -95,7 +95,7 @@ export class LaunchService implements ILaunchService { let usedWindows: VSCodeWindow[]; if (!!args.extensionDevelopmentPath) { this.windowsService.openExtensionDevelopmentHostWindow({ context, cli: args, userEnv }); - } else if (args._.length === 0 && (args['new-window'] || args['new-window-if-not-first'])) { + } else if (args._.length === 0 && (args['new-window'] || args['unity-launch'])) { usedWindows = this.windowsService.open({ context, cli: args, userEnv, forceNewWindow: true, forceEmpty: true }); } else if (args._.length === 0) { usedWindows = [this.windowsService.focusLastActive(args, context)]; diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index 523dc06bc50..ba8f2436591 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -259,7 +259,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo } else if (global.macOpenFiles && global.macOpenFiles.length && (!environmentService.args._ || !environmentService.args._.length)) { windowsMainService.open({ context: OpenContext.DOCK, cli: environmentService.args, pathsToOpen: global.macOpenFiles, initialStartup: true }); // mac: open-file event received on startup } else { - windowsMainService.open({ context, cli: environmentService.args, forceNewWindow: environmentService.args['new-window'] || environmentService.args['new-window-if-not-first'], diffMode: environmentService.args.diff, initialStartup: true }); // default: read paths from cli + windowsMainService.open({ context, cli: environmentService.args, forceNewWindow: environmentService.args['new-window'] || (!environmentService.args._.length && environmentService.args['unity-launch']), diffMode: environmentService.args.diff, initialStartup: true }); // default: read paths from cli } // Install Menu diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts index d3f54e8d5aa..9a3509e0c54 100644 --- a/src/vs/platform/environment/common/environment.ts +++ b/src/vs/platform/environment/common/environment.ts @@ -14,7 +14,10 @@ export interface ParsedArgs { diff?: boolean; goto?: boolean; 'new-window'?: boolean; - 'new-window-if-not-first'?: boolean; + /** + * Always open a new window, except if opening the first window or opening a file or folder as part of the launch. + */ + 'unity-launch'?: boolean; 'reuse-window'?: boolean; locale?: string; 'user-data-dir'?: string; diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts index 242222b67a8..89ccbfc3a53 100644 --- a/src/vs/platform/environment/node/argv.ts +++ b/src/vs/platform/environment/node/argv.ts @@ -31,7 +31,7 @@ const options: minimist.Opts = { 'diff', 'goto', 'new-window', - 'new-window-if-not-first', + 'unity-launch', 'reuse-window', 'performance', 'verbose',