In my Electron app, I would like to do something that is done very often in other OSX apps. That is... I would like to NOT close the app of the red X is clicked in the top right. But, if they right click the app icon in the dock, and say Quit, then I would like to quit the app. How do I do this?
I have tried using the onbeforeunload
event from the rendererProcess, as well as the browserWindow.on("close", fn)
event to try and prevent this. The problem is that they both file the onbeforeunload
event. And I can't tell the different between the red X being clicked and the dock icon being right clicked and told to quit. Any help would be nice. Has anyone else done this in Electron for OSX?