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
+1 -1
Submodule assets updated: f106946659...bd432f2298
+6 -6
View File
@@ -1,6 +1,7 @@
import { Menu, Tray, nativeImage } from "electron"; import { Menu, Tray, nativeImage } from "electron";
import trayIconAsset from "../../assets/desktop/icon.png?asset"; import trayIconAsset from "../../assets/desktop/icon.png?asset";
import macOsTrayIconAsset from "../../assets/desktop/iconTemplate.png?asset";
import { version } from "../../package.json"; import { version } from "../../package.json";
import { mainWindow, quitApp } from "./window"; import { mainWindow, quitApp } from "./window";
@@ -10,16 +11,15 @@ let tray: Tray = null;
// Create and resize tray icon for macOS // Create and resize tray icon for macOS
function createTrayIcon() { function createTrayIcon() {
const image = nativeImage.createFromDataURL(trayIconAsset); if (process.platform === "darwin") {
const image = nativeImage.createFromDataURL(macOsTrayIconAsset);
const resized = image.resize({ width: 20, height: 20 }); const resized = image.resize({ width: 20, height: 20 });
// Mark as template image so it adapts to dark/light mode
resized.setTemplateImage(true); resized.setTemplateImage(true);
return resized; return resized;
} else {
return nativeImage.createFromDataURL(trayIconAsset);
}
} }
// trayIcon.setTemplateImage(true);
export function initTray() { export function initTray() {
const trayIcon = createTrayIcon(); const trayIcon = createTrayIcon();