feat: allow showing a window without foregrounding it on macOS - #52962
feat: allow showing a window without foregrounding it on macOS#52962liamcmitchell wants to merge 3 commits into
Conversation
Adds a `bringToFront` option to `showInactive()`. When set to `false`, the window is shown at the back of the window stack using `orderBack:` instead of `orderFrontRegardless`. This is useful for apps that auto-update in the background and need to recreate windows without interrupting the user.
|
💖 Thanks for opening this pull request! 💖 Semantic PR titlesWe use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Commit signingThis repo enforces commit signatures for all incoming PRs. PR tipsThings that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
| [window_ orderFrontRegardless]; | ||
| } else { | ||
| // Show window at the back of the window stack. | ||
| [window_ orderBack:nil]; |
There was a problem hiding this comment.
I wonder if sending the window to the back of the stack is always what developers would want? Perhaps leaving the window wherever it was on the stack previously would also be a preference? I'm not sure what the behavior is if you don't call orderBack, but this makes me wonder if this property should be an enum rather than a bool, to allow for other behaviors.
There was a problem hiding this comment.
I can't see a convenient API to get or set the exact position in the stack. The only other related API I see in their docs is order relative to another window: https://developer.apple.com/documentation/appkit/nswindow/order(_:relativeto:)
Description of Change
Continuing #49402
On top of the work done by @danteissaias:
Checklist
npm testpasses (for the tests related to what I have changed...)Release Notes
Notes: Added a bringToFront option to showInactive() for macOS. When set to false, the window is shown at the back of the window stack.