Closed ericblade closed 3 years ago
Update: running it in preload seems to require waiting until after document has fired the loaded event. Anytime before that, results in same error. The "titleBarStyle: 'hidden'" has no effect at all, though, and now most of my windows have both the original title bar and the one from this lib. One of them still refuses to display the custom title bar, I suspect that the application being loaded in that window may be overwriting it. Many issues at play here :|
.... titleBarStyle is MacOS only.
Do you wait until the DOMContentLoaded-Event with creating the titlebar? Because it looks like document.head
is null
. I just checked and in fact, during the execution time of the preload.js document.head == null
is true.
And about
titleBarStyle is MacOS only.
Yes, that's only for Mac, but you can use frame: false
for non mac operating systems.
ok, so, to get this to work in Windows, from a preload, i have to run it in an eventListener on 'load', and also create the windows using frame: false. OK, so, it also doesn't track document.title, which can be a bit of an issue, but i suppose I can create something that polls that, although i don't have direct access to the title.
It does seem that it drastically changes the window dimensions, though. When I run with this, I suddenly have both vertical and horizontal scrollbars that did not exist in my app previously.
Seems some documentation updates and maybe some code tweaks are necessary to get this to be mostly plug-and-play :)
Thank you !
I'll see if I can conjure up some PRs if I continue working with this.
Follow instructions in readme, adding new TitleBar() to renderer preload, and titleBarStyle to new BrowserWindow() call