fix: use template icon for macOS tray, use higher res icons for other platforms (#130)

This commit is contained in:
Paul Makles
2026-02-17 20:36:25 +00:00
committed by GitHub
parent 8284117e76
commit 58ccb63d23
2 changed files with 10 additions and 10 deletions
+9 -9
View File
@@ -1,6 +1,7 @@
import { Menu, Tray, nativeImage } from "electron";
import trayIconAsset from "../../assets/desktop/icon.png?asset";
import macOsTrayIconAsset from "../../assets/desktop/iconTemplate.png?asset";
import { version } from "../../package.json";
import { mainWindow, quitApp } from "./window";
@@ -10,17 +11,16 @@ let tray: Tray = null;
// Create and resize tray icon for macOS
function createTrayIcon() {
const image = nativeImage.createFromDataURL(trayIconAsset);
const resized = image.resize({ width: 20, height: 20 });
// Mark as template image so it adapts to dark/light mode
resized.setTemplateImage(true);
return resized;
if (process.platform === "darwin") {
const image = nativeImage.createFromDataURL(macOsTrayIconAsset);
const resized = image.resize({ width: 20, height: 20 });
resized.setTemplateImage(true);
return resized;
} else {
return nativeImage.createFromDataURL(trayIconAsset);
}
}
// trayIcon.setTemplateImage(true);
export function initTray() {
const trayIcon = createTrayIcon();
tray = new Tray(trayIcon);