authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-03-02 13:48:42-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-03-02 13:49:04-08:00
loga3aa4bd189721a87271e9d7a1bed0cb605bc5eee
tree972d4624fc4c7ab88b79b00a91fffddddecbf12d
parent5a0006f7efabb03888573a2029f1d0a30b614422

Fix destructive menu icon showing app logo on non-macOS

getDestructiveMenuIcon fell back to resolveIconPath("png") on Windows/Linux which resolved to the T3 Code app icon, not a trash icon. Restrict the icon to macOS where createFromNamedImage("trash") provides the correct system icon. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

1 files changed, 6 insertions(+), 13 deletions(-)

apps/desktop/src/main.ts+6-13
...@@ -40,27 +40,20 @@ let desktopProtocolRegistered = false;...@@ -40,27 +40,20 @@ let desktopProtocolRegistered = false;
40let destructiveMenuIconCache: Electron.NativeImage | null | undefined;40let destructiveMenuIconCache: Electron.NativeImage | null | undefined;
4141
42function getDestructiveMenuIcon(): Electron.NativeImage | undefined {42function getDestructiveMenuIcon(): Electron.NativeImage | undefined {
43 if (process.platform !== "darwin") return undefined;
43 if (destructiveMenuIconCache !== undefined) {44 if (destructiveMenuIconCache !== undefined) {
44 return destructiveMenuIconCache ?? undefined;45 return destructiveMenuIconCache ?? undefined;
45 }46 }
46 try {47 try {
47 const icon =48 const icon = nativeImage.createFromNamedImage("trash").resize({
48 process.platform === "darwin"49 width: 14,
49 ? nativeImage.createFromNamedImage("trash").resize({50 height: 14,
50 width: 14,51 });
51 height: 14,
52 })
53 : nativeImage.createFromPath(resolveIconPath("png") ?? "").resize({
54 width: 14,
55 height: 14,
56 });
57 if (icon.isEmpty()) {52 if (icon.isEmpty()) {
58 destructiveMenuIconCache = null;53 destructiveMenuIconCache = null;
59 return undefined;54 return undefined;
60 }55 }
61 if (process.platform === "darwin") {56 icon.setTemplateImage(true);
62 icon.setTemplateImage(true);
63 }
64 destructiveMenuIconCache = icon;57 destructiveMenuIconCache = icon;
65 return icon;58 return icon;
66 } catch {59 } catch {