Skip to content
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

Implement native OS X window handling for close/quit #12

Open
ggamel opened this issue Oct 13, 2015 · 14 comments
Open

Implement native OS X window handling for close/quit #12

ggamel opened this issue Oct 13, 2015 · 14 comments
Labels

Comments

@ggamel
Copy link
Contributor

ggamel commented Oct 13, 2015

Is there interest in implementing native OS X window handling for close/quit? If so, a personal project of mine has this functionality working 100% and it's 👌🏻👌🏻👌🏻. Improves the app experience (for me at least) by making the app feel far more native.

Pressing Cmd+Q and Cmd+W under OS X are common actions taken by OS X users:

  • Pressing Cmd+W results in the active app window being closed/hidden, but still active and not terminated in the background
  • Pressing Cmd+Q results in the active app window being quit/terminated.
  • Pressing the red X traffic light results in the active app window being closed/hidden, but still active and not terminated in the background.
  • Clicking the OS X dock icon for an app activates/reveals/unhides the closed/hidden app window

Thoughts? It shouldn't be a big deal for me to implement for photon, but figured I would test the waters to see if the interest is there.

@knownasilya
Copy link

Sounds like a nice UX addition.

@gosukiwi
Copy link

Sounds quite nice. Afterall the project seems very OS X oriented.

@pilot
Copy link

pilot commented Oct 14, 2015

👍

1 similar comment
@pbernasconi
Copy link

👍

@ggamel
Copy link
Contributor Author

ggamel commented Oct 15, 2015

Submitted PR #29 to implement native OS X window handling.

@connors
Copy link
Owner

connors commented Oct 16, 2015

Isn't this behavior already there? All the keyboard commands you listed already work for me when I launch the template app.

@ggamel
Copy link
Contributor Author

ggamel commented Oct 16, 2015

Not in Electron core. There are a few issues in the GH issues for it, but not out of the box.

@connors
Copy link
Owner

connors commented Oct 16, 2015

@ggamel I'm curious, which version of OS X are you running?

@ggamel
Copy link
Contributor Author

ggamel commented Oct 16, 2015

@connors: OS X 10.11. No betas.

@ggamel
Copy link
Contributor Author

ggamel commented Oct 16, 2015

@connors Also see: sindresorhus/caprine#6

This is something that others have been wanting, but is apparently not included in Electron by default. My implementation has been working as expected. 😄

@connors
Copy link
Owner

connors commented Oct 16, 2015

@ggamel Weird. I'm confused because when I run npm start, I can do all the behaviors you've listed.

This line in app.js makes sure that the default OS X behavior is respected.

@ggamel
Copy link
Contributor Author

ggamel commented Oct 16, 2015

@connors Crazy! I'll try again with a fresh copy of photon to see if it's in-line with your experience. Otherwise, I'll make a screencast to show you!

@ggamel
Copy link
Contributor Author

ggamel commented Oct 16, 2015

Okay, @connors: I received the exact same window behavior from a vanilla clone.

See:
electron-osx10 11-photonwindow

Any ideas on what the issue could be?

@ggamel
Copy link
Contributor Author

ggamel commented Oct 17, 2015

@connors I just realized I never listed clicking the dock icon and showing the app window in my original issue comment. Just updated that comment to clarify!

Are you able to click the dock icon to activate the Photon app window?

My code/commit introduces:

  • the ability for the active Photon window to persist in the background, even after pressing Cmd+W or the red X stoplight, meaning if audio is playing in the Photon window, for instance, it will continue uninterupted
  • the ability to activate again by clicking the app icon.

Essentially, the default behavior in Electron (this line), after pressing Cmd+W or the X stoplight destroys the BrowserWindow, meaning you either have to recreate it (acceptable in some situations) or have some code that keeps it alive/hidden. My code ensures the BrowserWindow hasn't been destroyed and instead persists until you force quit or Cmd+Q. 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants