fix: use template icon for macOS tray, use higher res icons for other platforms (#130)
This commit is contained in:
parent
8284117e76
commit
58ccb63d23
2 changed files with 10 additions and 10 deletions
2
assets
2
assets
|
|
@ -1 +1 @@
|
|||
Subproject commit f106946659af67ad4f008588ac51570029b2fd47
|
||||
Subproject commit bd432f2298901a8566a092636eef0c35a3a80fbc
|
||||
|
|
@ -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,16 +11,15 @@ let tray: Tray = null;
|
|||
|
||||
// Create and resize tray icon for macOS
|
||||
function createTrayIcon() {
|
||||
const image = nativeImage.createFromDataURL(trayIconAsset);
|
||||
if (process.platform === "darwin") {
|
||||
const image = nativeImage.createFromDataURL(macOsTrayIconAsset);
|
||||
const resized = image.resize({ width: 20, height: 20 });
|
||||
|
||||
// Mark as template image so it adapts to dark/light mode
|
||||
resized.setTemplateImage(true);
|
||||
|
||||
return resized;
|
||||
} else {
|
||||
return nativeImage.createFromDataURL(trayIconAsset);
|
||||
}
|
||||
}
|
||||
|
||||
// trayIcon.setTemplateImage(true);
|
||||
|
||||
export function initTray() {
|
||||
const trayIcon = createTrayIcon();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue