mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
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:
parent
019ce0eb56
commit
94f30c3e8b
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -30,6 +30,7 @@ const options: minimist.Opts = {
|
|||
'diff',
|
||||
'goto',
|
||||
'new-window',
|
||||
'new-window-if-not-first',
|
||||
'reuse-window',
|
||||
'performance',
|
||||
'verbose',
|
||||
|
|
Loading…
Reference in a new issue