feat: add show option to BrowserWindow for deferred visibility#175
Open
ragamufin wants to merge 1 commit intoblackboardsh:mainfrom
Open
feat: add show option to BrowserWindow for deferred visibility#175ragamufin wants to merge 1 commit intoblackboardsh:mainfrom
ragamufin wants to merge 1 commit intoblackboardsh:mainfrom
Conversation
Allow creating windows without immediately showing them via show: false. Enables E2E testing, splash screens, and background window patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a
showoption toBrowserWindowthat controls whether the window is displayed immediately on creation. Defaults totrue(current behavior).When
show: falseis passed, the window is created butshowWindow()is skipped. The window can be made visible later by callingwindow.show().Motivation
Electron's
BrowserWindowsupportsshow: false, which is commonly used for:This is a small, backwards-compatible change — existing code that doesn't pass
showcontinues to work identically.Changes
BrowserWindow.ts: Addedshow?: booleantoWindowOptionsType, addedshow: trueto default options, passed through constructor → init → createWindownative.ts: Addedshow?: booleantocreateWindowparams, wrappedshowWindow()inif (params.show !== false)guardUsage
Testing
Tested locally on macOS ARM64:
new BrowserWindow()with noshowoption → window appears immediately ✓new BrowserWindow({ show: false })→ window created but not visible ✓window.show()on hidden window → window becomes visible ✓