Skip to content

feat: allow showing a window without foregrounding it on macOS - #52962

Open
liamcmitchell wants to merge 3 commits into
electron:mainfrom
liamcmitchell:show-behind
Open

feat: allow showing a window without foregrounding it on macOS#52962
liamcmitchell wants to merge 3 commits into
electron:mainfrom
liamcmitchell:show-behind

Conversation

@liamcmitchell

Copy link
Copy Markdown

Description of Change

Continuing #49402

Closes #49393
Adds a bringToFront option to showInactive() for macOS. 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.

On top of the work done by @danteissaias:

  • fixes clang-tidy warning by removing default args, inlining default instead
  • moves tests next to existing showInactive tests
  • refactors tests

Checklist

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.

danteissaias and others added 3 commits August 18, 2026 10:56
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.
@welcome

welcome Bot commented Aug 18, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

Semantic PR titles

We 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:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Commit signing

This repo enforces commit signatures for all incoming PRs.
To sign your commits, see GitHub's documentation on Telling Git about your signing key.

PR tips

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

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.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 18, 2026
@jkleinsc jkleinsc added the semver/minor backwards-compatible functionality label Aug 19, 2026
[window_ orderFrontRegardless];
} else {
// Show window at the back of the window stack.
[window_ orderBack:nil];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review/requested 🗳 new-pr 🌱 PR opened recently semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow showing a window without foregrounding it on macOS

4 participants