Skip to content

Commit fc92ea4

Browse files
committed
Do not force new window when opening file or folder with launch on Unity (fixes microsoft#21133)
1 parent a75e535 commit fc92ea4

5 files changed

Lines changed: 8 additions & 5 deletions

File tree

resources/linux/code.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Name=@@NAME_LONG@@
33
Comment=Code Editing. Redefined.
44
GenericName=Text Editor
5-
Exec=/usr/share/@@NAME@@/@@NAME@@ --new-window-if-not-first %U
5+
Exec=/usr/share/@@NAME@@/@@NAME@@ --unity-launch %U
66
Icon=@@NAME@@
77
Type=Application
88
StartupNotify=true

src/vs/code/electron-main/launch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class LaunchService implements ILaunchService {
9595
let usedWindows: VSCodeWindow[];
9696
if (!!args.extensionDevelopmentPath) {
9797
this.windowsService.openExtensionDevelopmentHostWindow({ context, cli: args, userEnv });
98-
} else if (args._.length === 0 && (args['new-window'] || args['new-window-if-not-first'])) {
98+
} else if (args._.length === 0 && (args['new-window'] || args['unity-launch'])) {
9999
usedWindows = this.windowsService.open({ context, cli: args, userEnv, forceNewWindow: true, forceEmpty: true });
100100
} else if (args._.length === 0) {
101101
usedWindows = [this.windowsService.focusLastActive(args, context)];

src/vs/code/electron-main/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
259259
} else if (global.macOpenFiles && global.macOpenFiles.length && (!environmentService.args._ || !environmentService.args._.length)) {
260260
windowsMainService.open({ context: OpenContext.DOCK, cli: environmentService.args, pathsToOpen: global.macOpenFiles, initialStartup: true }); // mac: open-file event received on startup
261261
} else {
262-
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
262+
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
263263
}
264264

265265
// Install Menu

src/vs/platform/environment/common/environment.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ export interface ParsedArgs {
1414
diff?: boolean;
1515
goto?: boolean;
1616
'new-window'?: boolean;
17-
'new-window-if-not-first'?: boolean;
17+
/**
18+
* Always open a new window, except if opening the first window or opening a file or folder as part of the launch.
19+
*/
20+
'unity-launch'?: boolean;
1821
'reuse-window'?: boolean;
1922
locale?: string;
2023
'user-data-dir'?: string;

src/vs/platform/environment/node/argv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const options: minimist.Opts = {
3131
'diff',
3232
'goto',
3333
'new-window',
34-
'new-window-if-not-first',
34+
'unity-launch',
3535
'reuse-window',
3636
'performance',
3737
'verbose',

0 commit comments

Comments
 (0)