2

I am using electron tray in my application but when I quit the app ,the tray doesn't close immediately.Instead on hover, it closes immediately .Is there any solution that I can use to avoid this?

Kshama Jain
  • 111
  • 1
  • 8

1 Answers1

4

Try destroying the tray icon before the app quits like this:

app.on('before-quit', function (evt) {
    tray.destroy();
});

tray.destroy() Docs.

before-quit Event docs.

Joshua
  • 5,032
  • 2
  • 29
  • 45