diff --git a/emrg/gui/main.js b/emrg/gui/main.js index 678d778..b2a175b 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 143d17d..e3e5328 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 +}