github.com/secoba/wails/v2@v2.6.4/pkg/templates/generate/plain/main.go.tmpl (about)

     1  package main
     2  
     3  import (
     4  "embed"
     5  "log"
     6  
     7  "github.com/wailsapp/wails/v2/pkg/options/mac"
     8  
     9  "github.com/wailsapp/wails/v2"
    10  "github.com/wailsapp/wails/v2/pkg/logger"
    11  "github.com/wailsapp/wails/v2/pkg/options"
    12  "github.com/wailsapp/wails/v2/pkg/options/assetserver"
    13  "github.com/wailsapp/wails/v2/pkg/options/windows"
    14  )
    15  
    16  //go:embed frontend/src
    17  var assets embed.FS
    18  
    19  //go:embed build/appicon.png
    20  var icon []byte
    21  
    22  func main() {
    23  // Create an instance of the app structure
    24  app := NewApp()
    25  
    26  // Create application with options
    27  err := wails.Run(&options.App{
    28  Title:             "{{.ProjectName}}",
    29  Width:             1024,
    30  Height:            768,
    31  MinWidth:          1024,
    32  MinHeight:         768,
    33  MaxWidth:          1280,
    34  MaxHeight:         800,
    35  DisableResize:     false,
    36  Fullscreen:        false,
    37  Frameless:         false,
    38  StartHidden:       false,
    39  HideWindowOnClose: false,
    40  BackgroundColour:  &options.RGBA{R: 27, G: 38, B: 54, A: 1},
    41  AssetServer:       &assetserver.Options{
    42      Assets: assets,
    43  },
    44  Menu:              nil,
    45  Logger:            nil,
    46  LogLevel:          logger.DEBUG,
    47  OnStartup:         app.startup,
    48  OnDomReady:        app.domReady,
    49  OnBeforeClose:     app.beforeClose,
    50  OnShutdown:        app.shutdown,
    51  WindowStartState:  options.Normal,
    52  Bind: []interface{}{
    53  app,
    54  },
    55  // Windows platform specific options
    56  Windows: &windows.Options{
    57  WebviewIsTransparent: false,
    58  WindowIsTranslucent:  false,
    59  DisableWindowIcon:    false,
    60  // DisableFramelessWindowDecorations: false,
    61  WebviewUserDataPath: "",
    62  },
    63  Mac: &mac.Options{
    64  TitleBar: &mac.TitleBar{
    65  TitlebarAppearsTransparent: true,
    66  HideTitle:                  false,
    67  HideTitleBar:               false,
    68  FullSizeContent:            false,
    69  UseToolbar:                 false,
    70  HideToolbarSeparator:       true,
    71  },
    72  Appearance:           mac.NSAppearanceNameDarkAqua,
    73  WebviewIsTransparent: true,
    74  WindowIsTranslucent:  true,
    75  About: &mac.AboutInfo{
    76  Title:   "Plain Template",
    77  Message: "Part of the Wails projects",
    78  Icon:    icon,
    79  },
    80  },
    81  })
    82  
    83  if err != nil {
    84  log.Fatal(err)
    85  }
    86  }