I am creating an app using Go-Astilectron (an Electron framework for Go).
My app has a frameless and transparent window that should be resized depending on its content. As far as I could tell, I am obligated to set the width
and height
properties of a Window in Electron, otherwise it will default to 800x600.
What I would like to know is if there is a way for Electron to automatically resize the window based on its content.
I could use a "One Size Fits All" approach, but since my window is frameless and transparent, some parts of it will eventually be on top of other things, and since there is not click through, the user will get confused thinking that he is clicking on some other application, when he is actually clicking on my app.
Here is my code to create the window:
var w *astilectron.Window
log.Debug("Starting astilectron...")
window := []*bootstrap.Window{{
Homepage: "http://localhost:3000",
Adapter: func(i *astilectron.Window) {
w = i
},
Options: &astilectron.WindowOptions{
MinHeight: astilectron.PtrInt(50),
MinWidth: astilectron.PtrInt(50),
AlwaysOnTop: astilectron.PtrBool(true),
Transparent: astilectron.PtrBool(true),
Closable: astilectron.PtrBool(false),
Minimizable: astilectron.PtrBool(false),
Frame: astilectron.PtrBool(false),
Movable: astilectron.PtrBool(true),
SkipTaskbar: astilectron.PtrBool(false),
Resizable: astilectron.PtrBool(false),
},
}}
go func() {
err := bootstrap.Run(bootstrap.Options{
Windows: window,
Debug: true,
})
if err != nil {
log.WithError(err).Fatal("Error with Astilectron")
}
}()