Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update tray icon

In Electron, it is possible to create a tray icon by using new Tray(image), for example:

let iconPath = path.join(__dirname, 'icon.png');
appIcon = new Tray(iconPath);

As stated in the documentation:

..
Creates a new tray icon associated with the image.
..


Is it possible to replace the current Tray icon, instead of creating a new one?

like image 215
Sam Denty Avatar asked Oct 27 '25 12:10

Sam Denty


1 Answers

This is possible by using the tray.setImage(image) function.

Example:

let iconPath = path.join(__dirname, 'icon.png');
appIcon.setImage(iconPath);
like image 88
Sam Denty Avatar answered Oct 30 '25 03:10

Sam Denty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!