Differentiate between X close button and Close option on top left icon´s menu


Hello everyone!

I´m trying to differentiate behavior of app when clicking on window X button and top left icon´s Menu option.

I have tried to handle it by window.on(‘close’) & app.on(‘before-quit’) without success.
BTW, I expected that before-quit event is supposed to run before ‘close’ event but at least on Windows 10 this is not seen. Does anybody have info on this behavior detail?