Fixed the application name on macOS.

Patch for eclipse-theia/theia#8701.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2020-11-03 16:40:28 +01:00 committed by Akos Kitta
parent 874c3efa2c
commit 781747fe80

View File

@ -3,11 +3,20 @@ import { app } from 'electron';
import { fork } from 'child_process'; import { fork } from 'child_process';
import { AddressInfo } from 'net'; import { AddressInfo } from 'net';
import { ElectronSecurityToken } from '@theia/core/lib/electron-common/electron-token'; import { ElectronSecurityToken } from '@theia/core/lib/electron-common/electron-token';
import { FrontendApplicationConfig } from '@theia/application-package/lib/application-props';
import { ElectronMainApplication as TheiaElectronMainApplication, TheiaBrowserWindowOptions } from '@theia/core/lib/electron-main/electron-main-application'; import { ElectronMainApplication as TheiaElectronMainApplication, TheiaBrowserWindowOptions } from '@theia/core/lib/electron-main/electron-main-application';
@injectable() @injectable()
export class ElectronMainApplication extends TheiaElectronMainApplication { export class ElectronMainApplication extends TheiaElectronMainApplication {
async start(config: FrontendApplicationConfig): Promise<void> {
// Explicitly set the app name to have better menu items on macOS. ("About", "Hide", and "Quit")
// See: https://github.com/electron-userland/electron-builder/issues/2468
// Regression in Theia: https://github.com/eclipse-theia/theia/issues/8701
app.on('ready', () => app.setName(config.applicationName));
return super.start(config);
}
protected async getDefaultBrowserWindowOptions(): Promise<TheiaBrowserWindowOptions> { protected async getDefaultBrowserWindowOptions(): Promise<TheiaBrowserWindowOptions> {
const options = await super.getDefaultBrowserWindowOptions(); const options = await super.getDefaultBrowserWindowOptions();
return { return {