🍎 Add 'Hide' to App API for OS X only #4271
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When creating a popover window via global hotkey, you might want to return focus to the previous app after closing all windows.
For example:
http://stackoverflow.com/questions/22081215/return-focus-to-previous-apps-window-after-makekeyandorderfront
Without app.hide(), you need to interact (click on the window or cmd-tab away and back) to refocus.
![without-hide](https://cloud.githubusercontent.com/assets/147663/12679196/25d2d8ba-c6a3-11e5-98d5-b920ae6df03d.gif)
With app.hide(), you can return focus directly (gif says "hide before quit", should be "hide before close"):
![with-hide](https://cloud.githubusercontent.com/assets/147663/12679242/575a26c2-c6a3-11e5-85be-60d0d098732e.gif)
I don't think there's an equivalent for Linux or Windows so I've only done this for OS X and tagged it as such in the docs.