mirror of
https://github.com/stake-house/wagyu-key-gen.git
synced 2026-01-09 12:48:05 -05:00
Correctly set the app icon during window creation and AppImage target
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
@@ -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
BIN
static/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Reference in New Issue
Block a user