package main
import (
_ "embed"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
func main() {
app := application.New(application.Options{
Name: "Show macOS Toolbar",
Description: "A demo of the ShowToolbarWhenFullscreen option",
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
})
// Create window
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Toolbar hidden (default behaviour)",
HTML: "
Switch this window to fullscreen: the toolbar will be hidden
",
CSS: `body { background-color: blue; color: white; height: 100vh; display: flex; justify-content: center; align-items: center; }`,
Mac: application.MacWindow{
TitleBar: application.MacTitleBar{
UseToolbar: true,
HideToolbarSeparator: true,
},
},
})
// Create window
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Toolbar visible",
HTML: "Switch this window to fullscreen: the toolbar will stay visible
",
CSS: `body { background-color: red; color: white; height: 100vh; display: flex; justify-content: center; align-items: center; }`,
Mac: application.MacWindow{
TitleBar: application.MacTitleBar{
UseToolbar: true,
HideToolbarSeparator: true,
ShowToolbarWhenFullscreen: true,
},
},
})
err := app.Run()
if err != nil {
log.Fatal(err)
}
}