Skip to content

Commit

Permalink
windows tray icon refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
nbonamy committed Jan 1, 2025
1 parent d9a0467 commit 4d9704f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Binary file modified assets/icon.ico
Binary file not shown.
18 changes: 12 additions & 6 deletions src/main/tray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@ export default class {
const updateAvailable = this.autoUpdater.updateAvailable;

// tray icon
let trayIcon = null;
const assetsFolder = process.env.DEBUG ? path.resolve('./assets') : process.resourcesPath;
const iconColor = process.platform === 'linux' ? 'White' : 'Template';
const trayIconPath = path.join(assetsFolder, updateAvailable ? `bulbUpdate${iconColor}@2x.png` : `bulb${iconColor}@2x.png`);
//console.log('trayIconPath', trayIconPath);
const trayIcon = nativeImage.createFromPath(trayIconPath);
trayIcon.setTemplateImage(true);

if (process.platform === 'win32') {
const trayIconPath = path.join(assetsFolder, 'icon.ico');
trayIcon = nativeImage.createFromPath(trayIconPath);
} else {
const iconColor = process.platform === 'linux' ? 'White' : 'Template';
const trayIconPath = path.join(assetsFolder, updateAvailable ? `bulbUpdate${iconColor}@2x.png` : `bulb${iconColor}@2x.png`);
//console.log('trayIconPath', trayIconPath);
trayIcon = nativeImage.createFromPath(trayIconPath);
trayIcon.setTemplateImage(true);
}

// create tray
this.tray = new Tray(trayIcon);
this.tray.setContextMenu(Menu.buildFromTemplate(this.buildTrayMenu()));
Expand Down

0 comments on commit 4d9704f

Please sign in to comment.