-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quit on macOS from top or dock icon menus does not have "quit" value in "close" event #7365
Comments
The current behavior aligns with the document and is working as expected -- it is set to |
@rogerwang, thanks for quick reply. What we are really looking for is to be able to implement behavior that is somewhat standard for messaging app. Also, in regards to the top menu, it says Quit nwjs and shows Cmd+Q as shortcut, so it's expected that behavior for Cmd+Q would be similar to what you would get from clicking on menu button, but again, in nw2 mode it's no longer possible to distinguish click on the menu item and trigger actual quit of the app from click on close button on windows frame, as it was possible in nw1 mode. If behavior for click on Quit nwjs in top menu and click on Quit in dock icon menu changed in nw2 mode, is it possible to maybe add different values for the |
This is fixed in git and will be available in the next nightly build. Any further issues please let me know. |
Hi @rogerwang, it seems that the fix made it to 0.44.1 according to readme, thank you. We can see So, we still can not distinguish between intent to close the window (close button on window frame) and quit the app (i.e. clicking By the way, with
This error is not logged if you open Devtools prior to clicking |
Hey, yes I have just come to the exact same conclusion. This fix has worked beautifully for quitting from the top menu, but quitting from the dock icon menu still just hides the window rather than properly quitting the application. I have verified this using 0.44.1 using |
I've updated our nw2_quit_bug mini project to show the behaviour. If you run the app and then use the new "Settings" option in the tray menu to open a window, you will not be able to quit the app using the dock icon once the window has been opened. Note how in the close event I am hiding the window unless the function has been passed the "quit" value. It seems this value still isn't being passed from dock icon quit.
Should we create a new issue or re-open this one @rogerwang? Thanks so much for your work and for the new release earlier on! Hopefully this is an easy fix. |
Hi Today I install the latest version 0.51.2 and the issue is still reproducible. When I click on the Quit option from Dock 'close' event is not fired. I need to do some cleanup before quitting the application. Quit from the top menu bar works fine and it raises 'close' event. Am I doing something wrong? Is there any other way to do cleanup when the user quits from the dock? My Source Code: var gui = require('nw.gui'); if (platform() == 'darwin') { splashWindow.on('loaded', function() { splashWindow.on('close', function() { }); |
…its the application from the top menu bar on OSX. Python server will not be closed if the user quits the application from Dock, for this we have updated the issue nwjs/nw.js#7365 refs #6244
Fix available in this build: https://dl.nwjs.io/live-build/nw52/20210309-092729/6889ce56a/v0.52.1/ |
nwjs/chromium.src@594efa2
Reverting this commit seems fix those issue and the application quit normally, could you investigate further on this case? |
This is related to #7242 and #7355, but I'm specifically concerned about
quit
parameter ofclose
eventNWJS Version : 0.44.0
Operating System : macOS Catalina 10.15.3
Expected behavior
Clicking
Quit
on dock icon menu orQuit nwjs
from top menu should triggerclose
event withquit='quit'
Actual behavior
In
nw1
modeclose
event is triggered withquit='quit'
onQuit nwjs
from top menu and not triggered at all forQuit
from dock icon menu (the later is a bit unexpected, but ok)In
nw2
modeclose
event is triggered withquit=undefined
onQuit nwjs
from top menu orQuit
from dock icon menu.It's triggered as expected with
quit='quit'
oncontrol + Q
though.How to reproduce
Running the following in dev tools console and clicking
Quit
on dock icon menu orQuit nwjs
from top menu should do it:The text was updated successfully, but these errors were encountered: