0

I had build an electron app with the tutorial from here.

The problem is now, that the "minimize to tray" function and the 'autostart' function doesnt work anymore. When starting my app via npm start it works but not with the .exe

The code of the tray function is from this answer: Electron.js How to minimize/close window to system tray and restore window back from tray?

The code of the autostart function is from here: How to use auto-launch to start app on system startup?

Does anybody know why those functions doesnt work anymore after building a .exe? (Start as admin doesnt help)

sirzento
  • 537
  • 1
  • 5
  • 23

1 Answers1

0

The reason that this doesn't work for was that the path of the icon of the tray menu was defined as ./icon.png but after building the application, the file isn't at the same place anymore. All the app files are moved to ./resources/app/.

So this was the fix for me:

let trayIcon = null
if(!app.isPackaged) {
  trayIcon = './icon.png'; // when in dev mode
} else {
  trayIcon = './resources/app/icon.png';
}
sirzento
  • 537
  • 1
  • 5
  • 23