Skip to content

Instantly share code, notes, and snippets.

@dedSyn4ps3
Last active October 12, 2022 19:40
Show Gist options
  • Save dedSyn4ps3/e1a7039bd964bafabeb46d8d99c9868e to your computer and use it in GitHub Desktop.
Save dedSyn4ps3/e1a7039bd964bafabeb46d8d99c9868e to your computer and use it in GitHub Desktop.
Example Wails `main` file
package main
import (
"embed"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options/mac"
)
//go:embed all:frontend/dist
var assets embed.FS
//go:embed build/appicon.png
var icon []byte
func main() {
// Create an instance of the app structure
app := NewApp()
// Create application with options
err := wails.Run(&options.App{
Title: "myproject",
Width: 1024,
Height: 768,
Assets: assets,
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: app.startup,
Bind: []interface{}{
app,
},
// Below is an example of additional configuration settings for macOS builds //
Mac: &mac.Options{
TitleBar: &mac.TitleBar{
TitlebarAppearsTransparent: false,
HideTitle: false,
HideTitleBar: false,
FullSizeContent: true,
UseToolbar: false,
HideToolbarSeparator: true,
},
About: &mac.AboutInfo{
Title: "My Project",
Message: "An example Wails project for Medium readers",
Icon: icon,
},
},
})
if err != nil {
println("Error:", err.Error())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment