What I am trying to accomplish is having my application run, but when the user quits the application, I want to conditionally override the default quit behavior and do the following:
- hide all windows
- hide the application in the dock
- start up the tray
At this point, the application is still running, it’s just out of the way. The tray gives the user the ability to quit the application, relaunch the application, and open the current session (in other words show the dock icon and show the windows again).
Unfortunately, I am having a hard time accomplishing this, here’s a few attempts below:
- listening for ‘before-quit’ on electron app, and preventing default then calling hide() on my browserwindow.
- this doesn’t work because if your windows don’t close it never emits ‘will-quit’ *
- I listen for ‘close’ event on my browserwindow and hide it instead
- this doesn’t work, before-quit gets called, I hide my window and then it doesn’t call ‘will-quit’ *
Does anyone have any idea how to get past this?