Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/native/tray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ import { mainWindow, quitApp } from "./window";
// internal tray state
let tray: Tray = null;

// load the tray icon
const trayIcon = nativeImage.createFromDataURL(trayIconAsset);
// 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;
}

// trayIcon.setTemplateImage(true);

export function initTray() {
const trayIcon = createTrayIcon();
tray = new Tray(trayIcon);
updateTrayMenu();
tray.setToolTip("Stoat for Desktop");
Expand Down