Add --new-window-if-not-first CLI arg

This allows shift+click/middle+click/num+super Windows and Unity shortcuts to
work as expected while not changing regular launch behavior.

Part of #48
This commit is contained in:
Daniel Imms 2017-01-05 10:10:24 -08:00
parent 019ce0eb56
commit 94f30c3e8b
5 changed files with 6 additions and 4 deletions

View file

@ -2,7 +2,7 @@
Name=@@NAME_LONG@@
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/share/@@NAME@@/@@NAME@@ %U
Exec=/usr/share/@@NAME@@/@@NAME@@ --new-window-if-not-first %U
Icon=@@NAME@@
Type=Application
StartupNotify=true

View file

@ -93,7 +93,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']) {
} else if (args._.length === 0 && args['new-window'] || args['new-window-if-not-first']) {
usedWindows = this.windowsService.open({ context, cli: args, userEnv, forceNewWindow: true, forceEmpty: true });
} else if (args._.length === 0) {
usedWindows = [this.windowsService.focusLastActive(args, context)];
@ -102,7 +102,7 @@ export class LaunchService implements ILaunchService {
context,
cli: args,
userEnv,
forceNewWindow: args.wait || args['new-window'],
forceNewWindow: args.wait || args['new-window'] || args['new-window-if-not-first'],
preferNewWindow: !args['reuse-window'],
forceReuseWindow: args['reuse-window'],
diffMode: args.diff

View file

@ -257,7 +257,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'], diffMode: environmentService.args.diff, initialStartup: true }); // default: read paths from cli
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
}
// Install Menu

View file

@ -14,6 +14,7 @@ export interface ParsedArgs {
diff?: boolean;
goto?: boolean;
'new-window'?: boolean;
'new-window-if-not-first'?: boolean;
'reuse-window'?: boolean;
locale?: string;
'user-data-dir'?: string;

View file

@ -30,6 +30,7 @@ const options: minimist.Opts = {
'diff',
'goto',
'new-window',
'new-window-if-not-first',
'reuse-window',
'performance',
'verbose',