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": [ "extraFiles": [
"build/bin/*", "build/bin/*",
"build/word_lists/*" "build/word_lists/*",
"static/icon.png"
], ],
"mac": { "mac": {
"category": "public.app-category.utilities" "category": "public.app-category.utilities"
}, },
"linux": { "linux": {
"target": "deb" "target": "AppImage",
"icon": "static/icon.png"
}, },
"win": { "win": {
"target": "portable", "target": "portable",

View File

@@ -1,11 +1,30 @@
import { BrowserWindow, app, globalShortcut, ipcMain } from "electron"; 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", () => { app.on("ready", () => {
// once electron has started up, create a window. // 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({ const window = new BrowserWindow({
width: 900, width: 900,
height: 720, height: 720,
icon: 'src/images/ethstaker_icon_1.png', icon: iconPath,
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: true,

BIN
static/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB