Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch single instance on per default. #13831

Merged
merged 3 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
<a name="breaking_changes_not_yet_released">[Breaking Changes:](#breaking_changes_not_yet_released)</a>

- [filesystem] Adjusted the "Save As" mechanism. It now assumes that `Saveable.getSnapshot()` returns a full snapshot of the editor model [#13689](https://github.com/eclipse-theia/theia/pull/13689).

-->

- [electron] Switch single instance on per default [#13831](https://github.com/eclipse-theia/theia/pull/13831) - contributed on behalf of STMicroelectronics
-->
## 1.50.0 - 06/03/2024

- [application-package] bumped the default supported API from `1.88.1` to `1.89.1` [#13738](https://github.com/eclipse-theia/theia/pull/13738) - contributed on behalf of STMicroelectronics
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/application-package/src/application-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export namespace FrontendApplicationConfig {
export type BackendApplicationConfig = RequiredRecursive<BackendApplicationConfig.Partial>;
export namespace BackendApplicationConfig {
export const DEFAULT: BackendApplicationConfig = {
singleInstance: false,
singleInstance: true,
frontendConnectionTimeout: 0
};
export interface Partial extends ApplicationConfig {
Expand Down
21 changes: 13 additions & 8 deletions packages/core/src/electron-main/electron-main-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,14 +721,19 @@ export class ElectronMainApplication {
}

protected async onSecondInstance(event: ElectronEvent, argv: string[], cwd: string): Promise<void> {
const electronWindows = BrowserWindow.getAllWindows();
if (electronWindows.length > 0) {
const electronWindow = electronWindows[0];
if (electronWindow.isMinimized()) {
electronWindow.restore();
}
electronWindow.focus();
}
createYargs(this.processArgv.getProcessArgvWithoutBin(argv), process.cwd())
.help(false)
.command('$0 [file]', false,
cmd => cmd
.positional('file', { type: 'string' }),
async args => {
this.handleMainCommand({
file: args.file,
cwd: process.cwd(),
secondInstance: true
});
},
).parse();
}

protected onWindowAllClosed(event: ElectronEvent): void {
Expand Down
Loading