-
-
Notifications
You must be signed in to change notification settings - Fork 436
/
Copy pathfix-app-image-icon.ts
31 lines (30 loc) · 1.14 KB
/
fix-app-image-icon.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { environment } from '@theia/application-package/lib/environment';
import { isOSX, isWindows } from '@theia/core/lib/common/os';
import {
ElectronMainApplication,
ElectronMainApplicationContribution,
} from '@theia/core/lib/electron-main/electron-main-application';
import { injectable } from '@theia/core/shared/inversify';
import { join } from 'node:path';
// Fixes no application icon for the AppImage on Linux (https://github.com/arduino/arduino-ide/issues/131)
// The fix was based on https://github.com/eclipse-theia/theia-blueprint/pull/180.
// Upstream: https://github.com/electron-userland/electron-builder/issues/4617
@injectable()
export class FixAppImageIcon implements ElectronMainApplicationContribution {
onStart(application: ElectronMainApplication): void {
if (isOSX || isWindows || environment.electron.isDevMode()) {
return;
}
const windowOptions = application.config.electron.windowOptions;
if (windowOptions && windowOptions.icon === undefined) {
windowOptions.icon = join(
__dirname,
'..',
'..',
'resources',
'icons',
'512x512.png'
);
}
}
}