From 8b17fe6f51db255f78c66b8b8bb81fbbfbb5c827 Mon Sep 17 00:00:00 2001 From: EMRG Evolution Date: Tue, 11 Aug 2026 17:39:43 +0800 Subject: [PATCH] =?UTF-8?q?emrg:=20GUI=20packaged=20icon=20fix=20=E2=80=94?= =?UTF-8?q?=20explicit=20per-platform=20icons=20+=20window=20icon=20(rant?= =?UTF-8?q?=202026-08-11T17:37:03)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- emrg/gui/main.js | 12 ++++++++++++ emrg/gui/package.json | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/emrg/gui/main.js b/emrg/gui/main.js index 678d7787..b2a175be 100644 --- a/emrg/gui/main.js +++ b/emrg/gui/main.js @@ -56,10 +56,22 @@ function main() { // ── 窗口 ──────────────────────────────────────────────── + // rant 2026-08-11T17:37:03:打包版曾用 Electron 默认图标(蓝色原子球)。 + // package.json build.mac/win/linux.icon 显式指向 packaging/assets 单文件修复主图标; + // 这里为 Windows/Linux 窗口标题栏提供运行时图标(打包版经 extraResources 落到 resources/icon.png)。 + function windowIconPath() { + const candidates = [ + path.join(__dirname, "..", "icon.png"), // packaged: resources/icon.png(extraResources) + path.join(__dirname, "..", "packaging", "assets", "icon.png"), // source: 仓库 packaging/assets/icon.png + ]; + return candidates.find((p) => fs.existsSync(p)) || undefined; + } + function createWindow() { win = new BrowserWindow({ width: 1000, height: 700, + icon: windowIconPath(), webPreferences: { contextIsolation: true, nodeIntegration: false, diff --git a/emrg/gui/package.json b/emrg/gui/package.json index 143d17d2..e3e53283 100644 --- a/emrg/gui/package.json +++ b/emrg/gui/package.json @@ -28,6 +28,10 @@ { "from": "../dist/runtime", "to": "runtime" + }, + { + "from": "../packaging/assets/icon.png", + "to": "icon.png" } ], "files": [ @@ -41,7 +45,7 @@ "package.json", "scripts/**" ], - "icon": "../packaging/assets/", + "icon": "../packaging/assets/icon.png", "mac": { "hardenedRuntime": true, "notarize": false, @@ -54,7 +58,8 @@ ] } ], - "category": "public.app-category.developer-tools" + "category": "public.app-category.developer-tools", + "icon": "../packaging/assets/icon.icns" }, "win": { "target": [ @@ -64,7 +69,8 @@ "x64" ] } - ] + ], + "icon": "../packaging/assets/icon.ico" }, "linux": { "target": [ @@ -76,7 +82,8 @@ "from": "../dist/runtime", "to": "runtime" } - ] + ], + "icon": "../packaging/assets/icon.png" }, "nsis": { "oneClick": false, @@ -84,4 +91,4 @@ "perMachine": false } } -} \ No newline at end of file +}