fix: keep macOS Dock icon consistent with bundle icon (#1166)

This commit is contained in:
Jerry
2026-06-01 13:05:07 +08:00
committed by GitHub
parent 55faae767a
commit 429cb8d6e9
2 changed files with 17 additions and 9 deletions

View File

@@ -596,15 +596,6 @@ if (!gotLock) {
console.warn("[Main] Failed to install permission handlers:", err);
}
// Set dock icon on macOS
if (isMac && appIcon && app.dock?.setIcon) {
try {
app.dock.setIcon(appIcon);
} catch (err) {
console.warn("Failed to set dock icon", err);
}
}
// Build and set application menu. A broken menu should not take down
// the entire app — fall back to no custom menu and continue startup.
try {

View File

@@ -0,0 +1,17 @@
const test = require("node:test");
const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
test("main process leaves macOS Dock icon to the packaged app bundle", () => {
const mainProcess = fs.readFileSync(
path.join(__dirname, "../electron/main.cjs"),
"utf8",
);
assert.equal(
mainProcess.includes("app.dock.setIcon"),
false,
"Do not override the macOS Dock icon at runtime; it can render at a different size than the bundled .icns icon.",
);
});