Skip to content

Manager API

The Wails v3 Manager API provides an organised and discoverable way to access application functionality through focused manager structs grouped under public fields on *application.App. Wails 3 is a clean break from v2 — there is no per-call wrapper layer to maintain compatibility with the old app.NewWebviewWindow(...)-style API, so the managers below are the way to drive the app.

The Manager API organises application functionality into twelve focused areas (one logger plus eleven managers):

  • app.Window - Window creation, management, and callbacks
  • app.ContextMenu - Context menu registration and management
  • app.KeyBinding - Global key binding management
  • app.Browser - Browser integration (opening URLs and files)
  • app.Env - Environment information and system state
  • app.Dialog - File and message dialog operations
  • app.Event - Custom event handling and application events
  • app.Menu - Application menu management
  • app.Screen - Screen management and coordinate transformations
  • app.Clipboard - Clipboard text operations
  • app.SystemTray - System tray icon creation and management
  • app.Autostart - Register the application to launch at user login
  • Better discoverability - IDE autocomplete shows organized API surface
  • Improved code organization - Related methods grouped together
  • Enhanced maintainability - Separation of concerns across managers
  • Future extensibility - Easier to add new features to specific areas

The Manager API provides organized access to all application functionality:

// Events and custom event handling
app.Event.Emit("custom", data)
app.Event.On("custom", func(e *CustomEvent) { ... })
// Window management
window, _ := app.Window.GetByName("main")
app.Window.OnCreate(func(window Window) { ... })
// Browser integration
app.Browser.OpenURL("https://wails.io")
// Menu management
menu := app.Menu.New()
app.Menu.Set(menu)
// System tray
systray := app.SystemTray.New()

Manages window creation, retrieval, and lifecycle callbacks.

// Create windows
window := app.Window.New()
window := app.Window.NewWithOptions(options)
current := app.Window.Current()
// Find windows
window, exists := app.Window.GetByName("main")
windows := app.Window.GetAll()
// Window callbacks
app.Window.OnCreate(func(window Window) {
// Handle window creation
})

Handles custom events and application event listening.

// Custom events
app.Event.Emit("userAction", data)
cancelFunc := app.Event.On("userAction", func(e *CustomEvent) {
// Handle event
})
app.Event.Off("userAction")
app.Event.Reset() // Remove all listeners
// Application events
app.Event.OnApplicationEvent(events.Common.ThemeChanged, func(e *ApplicationEvent) {
// Handle system theme change
})

Provides browser integration for opening URLs and files.

// Open URLs and files in default browser
err := app.Browser.OpenURL("https://wails.io")
err := app.Browser.OpenFile("/path/to/document.pdf")

Access to system environment information.

// Get environment info
env := app.Env.Info()
fmt.Printf("OS: %s, Arch: %s\n", env.OS, env.Arch)
// Check system theme
if app.Env.IsDarkMode() {
// Dark mode is active
}
// Open file manager
err := app.Env.OpenFileManager("/path/to/folder", false)

Organized access to file and message dialogs.

// File dialogs
result, err := app.Dialog.OpenFile().
AddFilter("Text Files", "*.txt").
PromptForSingleSelection()
result, err = app.Dialog.SaveFile().
SetFilename("document.txt").
PromptForSingleSelection()
// Message dialogs
app.Dialog.Info().
SetTitle("Information").
SetMessage("Operation completed successfully").
Show()
app.Dialog.Error().
SetTitle("Error").
SetMessage("An error occurred").
Show()

Application menu creation and management.

// Create and set application menu
menu := app.Menu.New()
fileMenu := menu.AddSubmenu("File")
fileMenu.Add("New").OnClick(func(ctx *Context) {
// Handle menu click
})
app.Menu.Set(menu)
// Show about dialog
app.Menu.ShowAbout()

Dynamic management of global key bindings.

// Add key bindings
app.KeyBinding.Add("ctrl+n", func(window application.Window) {
// Handle Ctrl+N
})
app.KeyBinding.Add("ctrl+q", func(window application.Window) {
app.Quit()
})
// Remove key bindings
app.KeyBinding.Remove("ctrl+n")
// Get all bindings
bindings := app.KeyBinding.GetAll()

Advanced context menu management (for library authors).

// Create and register context menu
menu := app.ContextMenu.New()
app.ContextMenu.Add("myMenu", menu)
// Retrieve context menu
menu, exists := app.ContextMenu.Get("myMenu")
// Remove context menu
app.ContextMenu.Remove("myMenu")

Screen management and coordinate transformations for multi-monitor setups.

// Get screen information
screens := app.Screen.GetAll()
primary := app.Screen.GetPrimary()
// Coordinate transformations
physicalPoint := app.Screen.DipToPhysicalPoint(logicalPoint)
logicalPoint := app.Screen.PhysicalToDipPoint(physicalPoint)
// Screen detection
screen := app.Screen.ScreenNearestDipPoint(point)
screen = app.Screen.ScreenNearestDipRect(rect)

Clipboard operations for reading and writing text.

// Set text to clipboard
success := app.Clipboard.SetText("Hello World")
if !success {
// Handle error
}
// Get text from clipboard
text, ok := app.Clipboard.Text()
if !ok {
// Handle error
} else {
// Use the text
}

System tray icon creation and management.

// Create system tray
systray := app.SystemTray.New()
systray.SetLabel("My App")
systray.SetIcon(iconBytes)
// Add menu to system tray
menu := app.Menu.New()
menu.Add("Open").OnClick(func(ctx *Context) {
// Handle click
})
systray.SetMenu(menu)
// Destroy system tray when done
systray.Destroy()

Registers the application to launch at user login. Picks the appropriate native mechanism per platform: SMAppService or a LaunchAgent plist on macOS, the HKCU\…\Run registry key on Windows, an XDG .desktop entry on Linux.

// Register to launch at login
err := app.Autostart.Enable()
// With extra launch-time arguments and a custom identifier
err = app.Autostart.EnableWithOptions(application.AutostartOptions{
Identifier: "com.example.myapp",
Arguments: []string{"--hidden"},
})
// Check / remove
enabled, err := app.Autostart.IsEnabled()
status, err := app.Autostart.Status() // includes Path + Strategy
err = app.Autostart.Disable()

See the Autostart feature page for platform behaviour, identifier rules, and the stale-detection guarantee.