I have an electron js app with Angular 8. If the user performs the command control+w, it automatically closes the window. I try looking through the BrowserWindow Api, however, I couldn't find a flag or handler to prevent this behavior from happening.
You need to change or remove the default application menu which has this shortcut Window -> Close Ctrl+W by default
Menu.setApplicationMenu(null) // remove default application menu
// or
browserWindow.setMenu(null) // just remove default menu of a specific window and not all windows
This should do the trick
Relevant docs:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With