AlexTorresDev / custom-electron-titlebar

Custom electon title bar inpire on VS Code title bar
MIT License
870 stars 149 forks source link

Error initializing, does not seem to work at all #117

Closed ericblade closed 3 years ago

ericblade commented 3 years ago

Follow instructions in readme, adding new TitleBar() to renderer preload, and titleBarStyle to new BrowserWindow() call

image

ericblade commented 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 :|

ericblade commented 3 years ago

.... titleBarStyle is MacOS only.

timlg07 commented 3 years ago

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.

ericblade commented 3 years ago

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.