-
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
[mac] Need a way to differentiate Cmd-Q from closing window(s) [$500 awarded] #430
Comments
Probably just switching from |
I would work on this, but need some help on approach for this. |
Just hit this issue myself, I can make the app hide when clicking on the close button as many OSX apps do, but unfortunately I get the same behaviour when hitting CMD+Q. Ideally the window 'close' event would pass some sort of parameter with it to signify where the event came from, currently there is no parameter passed into the callback, so this could be done with backwards compatibility. @zcbenz - noticed you did the work on this area previously - thoughts? |
anyone figure this out? |
Would still love to see this tackled, seems like a fairly quick win from an outside perspective. |
+1 |
👍 |
@rogerwang any thoughts on this one? particularly useful in Mac apps as the different close types usually perform slightly different actions. I.e on most apps clicking the red cross minimises to the dock instead of hard quitting. |
@rogerwang in most usecases the expected behaviour of clicking on the red menubar button is that the application should minimize. With NW the app completely quits, simply passing some sort of parameter to know which way exit was triggered would (dock, menubar, shortcut) would allow us to handle this correctly. thoughts? |
Will fix this in 0.8.4 |
🎉 |
thx! |
@rogerwang quitting from dock still does not seem to send "quit" event |
@rogerwang @petejkim yup, dock quit still not triggering :( |
I can't help but wonder if this would be better just having a parameter on the exit event that tells you which of the places its being triggered from:
It's then upto the developer to choose whether the app should close in those situations? As some apps will want to close with the window and others not... |
@tommoor +1 |
@rogerwang please reopen this issue. |
Just another bump, personally feel like this should have more priority as it's basic window management :'( |
👍 |
1 similar comment
+1 |
👍 👍 |
the fix is merged and can be tried with http://dl.node-webkit.org/live-build/09-17-2014/mac64_master-build-187-4ab12b7-a2233c1-55a6ed5-ac542a9-1ce8544-86728d1/node-webkit-v0.10.6-pre-osx-x64.zip |
@rogerwang @mrfabbri do you have an outline of the final solution, how should we handle this? |
@tommoor yeah. we'll find a way to distinguish the source of the closing as you suggested. Please file another issue for it, perfectly with some API suggestions. |
@rogerwang I just don't understand what this fix does, how does it close the issue? Thanks! |
@tommoor the subject of the original report is lost, so I thought it was about NW should send an event when user tries to quit from dock. |
@tommoor I'm a little confused by what the issue is really about, because people are suggesting different things. Since you put the bounty on this issue, is your requirement exactly the comments you left on Jan 6? Do you have any suggestions on the API? |
Yes, as comments on Jan 6th. It comes down to the fact that on Mac some applications quit entirely when you click on the red button whilst others simply hide (usually communications/media apps like ours). I'd suggest making this similar to other events in Javascript, perhaps an event passed to the window close callback (good for future proofing). You could use the currentTarget property or a new property to avoid confusion eg 'source':
|
@rogerwang is that helpful? Personally wishing this will get fixed before Yosemite public release as we currently have a fake title bar built in CSS to get around this problem 😱 |
@tommoor when will be the public release? Currently we are focused on our deadline to catch Chrome 38 release with NW11, but I will try to fix this before that. |
@rogerwang now in GM (Gold Master) status, next release is public which will be before the end of the month, likely around three weeks. |
Hi @tommoor, 33c1255 fix the quit from dock (and also hitting In the v0.10.6-pre-osx-x64 version @rogerwang posted earlier in the thread you can try something like:
Right now the close event differentiates (only) between
By using That said, I think most of the use cases are having a simple differentiation between the close window versus quit application and the further differentiation for dock, menu should not hinder this simple case, i.e. being able to tell |
@mrfabbri appreciate the clarification. I'll give this a blast on the pre-release as soon as I can 😄 |
@mrfabbri @rogerwang I can confirm this works for the usecase, we should make sure to document this well 😃 Lets close this bad boy! |
@rogerwang Will there be a 0.10.6 release later? |
Hey @mrfabbri could you claim or decline the bounty on this issue? If you don't want it I would like to redistribute the money to some other issues in this repo that need solving 😄 |
claimed! 😄 |
My pleasure ;-) thanks! On Tue, Nov 18, 2014 at 11:48 AM, Marco Fabbri [email protected]
|
@rogerwang this can be closed. |
Thanks guys! this saved my day :) |
Common pattern for apps is to hide on window close but quit on
Menu->Quit
(Cmd-Q).Currently, Quit menu item calls
closeAllWindows
, thus triggeringclose
event for each window. There seems to be no straight way to distinguish between this two events.The $500 bounty on this issue has been claimed at Bountysource.
The text was updated successfully, but these errors were encountered: