merge: pull request #4 from e1berd/fix/macos-tray-icon
This commit is contained in:
commit
e11c0490fc
|
|
@ -8,12 +8,21 @@ import { mainWindow, quitApp } from "./window";
|
||||||
// internal tray state
|
// internal tray state
|
||||||
let tray: Tray = null;
|
let tray: Tray = null;
|
||||||
|
|
||||||
// load the tray icon
|
// Create and resize tray icon for macOS
|
||||||
const trayIcon = nativeImage.createFromDataURL(trayIconAsset);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// trayIcon.setTemplateImage(true);
|
// trayIcon.setTemplateImage(true);
|
||||||
|
|
||||||
export function initTray() {
|
export function initTray() {
|
||||||
|
const trayIcon = createTrayIcon();
|
||||||
tray = new Tray(trayIcon);
|
tray = new Tray(trayIcon);
|
||||||
updateTrayMenu();
|
updateTrayMenu();
|
||||||
tray.setToolTip("Stoat for Desktop");
|
tray.setToolTip("Stoat for Desktop");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue