neutralino.js icon indicating copy to clipboard operation
neutralino.js copied to clipboard

Preventing white flash when starting up the window

Open wiredmatt opened this issue 1 year ago • 1 comments

Hey! I'm the opposite of a complete fan when it comes to white flashes as you open up software, is there a way to achieve something similar to this?

Things I tried:

  1. Using CSS to set the background color of the body, and while that helps (slightly), the white flash is still there on startup.
  2. Setting "hidden": true in neutralino.config.json, but it seems you can't show a hidden application for some reason? (Binding the ready event to just to do Neutralino.window.show() -or any other- doesn't do anything, if this worked it'd solve my issue)

I was thinking maybe the "main" process can start hidden (specified the config file), and then you programatically create the actual user-facing window (in the background, somehow?) and show it after it's done rendering the black background (probably a timeout is enough) as per this https://neutralino.js.org/docs/api/window#windowcreateurl-windowoptions

Maybe also starting the window transparent and borderless and then disabling the transparency, with timeout as well.

Anyway a little bit lost here! Would appreciate more configuration options for the window / overridable window creation event.

wiredmatt avatar Apr 24 '24 23:04 wiredmatt

Setting "transparent: true" helps, no white flash at least.

wiredmatt avatar Apr 25 '24 01:04 wiredmatt

I was thinking maybe the "main" process can start hidden (specified the config file), and then you programatically create the actual user-facing window (in the background, somehow?) and show it after it's done rendering the black background (probably a timeout is enough) as per this https://neutralino.js.org/docs/api/window#windowcreateurl-windowoptions

That is a great idea

cquasar avatar Mar 01 '25 10:03 cquasar

I also tried solution number 2 just like you described but couldn't get it to work either. I'm on Windows 11 and would love to be able to remove the white flashing window on startup.

Another potential solution would be if the native window could load with another background color on default, before the CSS kicks in, but I see no option for this in the config file.

Setting "transparent: true" works but also removes the menu bar on Windows as noted in the docs, so it's not an option unfortunately, unless we could re-enable it after load.

Hannessa avatar May 09 '25 22:05 Hannessa