Correctly set the app icon during window creation and AppImage target

This commit is contained in:
Rémy Roy
2021-10-12 11:16:01 -04:00
parent 089c62d11b
commit da57de5d2f
3 changed files with 24 additions and 3 deletions

View File

@@ -58,13 +58,15 @@
],
"extraFiles": [
"build/bin/*",
"build/word_lists/*"
"build/word_lists/*",
"static/icon.png"
],
"mac": {
"category": "public.app-category.utilities"
},
"linux": {
"target": "deb"
"target": "AppImage",
"icon": "static/icon.png"
},
"win": {
"target": "portable",

View File

@@ -1,11 +1,30 @@
import { BrowserWindow, app, globalShortcut, ipcMain } from "electron";
import { cwd } from 'process';
import path from "path";
import { accessSync, constants } from "fs";
const doesFileExist = (filename: string): boolean => {
try {
accessSync(filename, constants.F_OK);
return true;
} catch (err) {
return false;
}
};
app.on("ready", () => {
// once electron has started up, create a window.
var iconPath = path.join("static", "icon.png");
const bundledIconPath = path.join(process.resourcesPath, "..", "static", "icon.png");
if (doesFileExist(bundledIconPath)) {
iconPath = bundledIconPath;
}
const window = new BrowserWindow({
width: 900,
height: 720,
icon: 'src/images/ethstaker_icon_1.png',
icon: iconPath,
webPreferences: {
nodeIntegration: true,

BIN
static/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB