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 <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Opus 4.6 committed 2026-03-02 13:48:42 -08:00
1 parent 7edd7e8faf
commit a2abe07b75
1 file changed
+6 -13
+6 -13
View File
@@ -40,27 +40,20 @@ let desktopProtocolRegistered = false;
let destructiveMenuIconCache: Electron.NativeImage | null | undefined;
function getDestructiveMenuIcon(): Electron.NativeImage | undefined {
if (process.platform !== "darwin") return undefined;
if (destructiveMenuIconCache !== undefined) {
return destructiveMenuIconCache ?? undefined;
}
try {
const icon =
process.platform === "darwin"
? nativeImage.createFromNamedImage("trash").resize({
width: 14,
height: 14,
})
: nativeImage.createFromPath(resolveIconPath("png") ?? "").resize({
width: 14,
height: 14,
});
const icon = nativeImage.createFromNamedImage("trash").resize({
width: 14,
height: 14,
});
if (icon.isEmpty()) {
destructiveMenuIconCache = null;
return undefined;
}
if (process.platform === "darwin") {
icon.setTemplateImage(true);
}
icon.setTemplateImage(true);
destructiveMenuIconCache = icon;
return icon;
} catch {