application

package
v3.0.0-alpha.57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 63 Imported by: 59

Documentation

Overview

Portions of this code are derived from the project: - https://github.com/fyne-io/systray

Index

Constants

View Source
const (
	CONTEXT_OPENED_FILES = "openedFiles"
	CONTEXT_FILENAME     = "filename"
	CONTEXT_URL          = "url"
)
View Source
const (
	// CmdOrCtrlKey represents Command on Mac and Control on other platforms
	CmdOrCtrlKey modifier = 0 << iota
	// OptionOrAltKey represents Option on Mac and Alt on other platforms
	OptionOrAltKey modifier = 1 << iota
	// ShiftKey represents the shift key on all systems
	ShiftKey modifier = 2 << iota
	// SuperKey represents Command on Mac and the Windows key on the other platforms
	SuperKey modifier = 3 << iota
	// ControlKey represents the control key on all systems
	ControlKey modifier = 4 << iota
)
View Source
const (
	ApplicationHide = 0
	ApplicationShow = 1
	ApplicationQuit = 2
)
View Source
const (
	CallBinding            = 0
	WindowKey   contextKey = "Window"
)
View Source
const (
	ClipboardSetText = 0
	ClipboardText    = 1
)
View Source
const (
	DialogInfo     = 0
	DialogWarning  = 1
	DialogError    = 2
	DialogQuestion = 3
	DialogOpenFile = 4
	DialogSaveFile = 5
)
View Source
const (
	ScreensGetAll     = 0
	ScreensGetPrimary = 1
	ScreensGetCurrent = 2
)
View Source
const (
	SystemIsDarkMode = 0
	Environment      = 1
	Capabilities     = 2
	Flags            = 3
)
View Source
const (
	WindowPosition                   = 0
	WindowCenter                     = 1
	WindowClose                      = 2
	WindowDisableSizeConstraints     = 3
	WindowEnableSizeConstraints      = 4
	WindowFocus                      = 5
	WindowForceReload                = 6
	WindowFullscreen                 = 7
	WindowGetScreen                  = 8
	WindowGetZoom                    = 9
	WindowHeight                     = 10
	WindowHide                       = 11
	WindowIsFocused                  = 12
	WindowIsFullscreen               = 13
	WindowIsMaximised                = 14
	WindowIsMinimised                = 15
	WindowMaximise                   = 16
	WindowMinimise                   = 17
	WindowName                       = 18
	WindowOpenDevTools               = 19
	WindowRelativePosition           = 20
	WindowReload                     = 21
	WindowResizable                  = 22
	WindowRestore                    = 23
	WindowSetPosition                = 24
	WindowSetAlwaysOnTop             = 25
	WindowSetBackgroundColour        = 26
	WindowSetFrameless               = 27
	WindowSetFullscreenButtonEnabled = 28
	WindowSetMaxSize                 = 29
	WindowSetMinSize                 = 30
	WindowSetRelativePosition        = 31
	WindowSetResizable               = 32
	WindowSetSize                    = 33
	WindowSetTitle                   = 34
	WindowSetZoom                    = 35
	WindowShow                       = 36
	WindowSize                       = 37
	WindowToggleFullscreen           = 38
	WindowToggleMaximise             = 39
	WindowToggleFrameless            = 40
	WindowUnFullscreen               = 41
	WindowUnMaximise                 = 42
	WindowUnMinimise                 = 43
	WindowWidth                      = 44
	WindowZoom                       = 45
	WindowZoomIn                     = 46
	WindowZoomOut                    = 47
	WindowZoomReset                  = 48
	WindowSnapAssist                 = 49
	WindowFilesDropped               = 50
	WindowPrint                      = 51
)
View Source
const (
	NSImageNone = iota
	NSImageOnly
	NSImageLeft
	NSImageRight
	NSImageBelow
	NSImageAbove
	NSImageOverlaps
	NSImageLeading
	NSImageTrailing
)
View Source
const (
	BrowserOpenURL = 0
)
View Source
const (
	ContextMenuOpen = 0
)
View Source
const (
	EventsEmit = 0
)

Variables

View Source
var AlphaAssets = AssetOptions{
	Handler: BundledAssetFileServer(alphaAssets),
}

AlphaAssets is the default assets for the alpha application

View Source
var BuildInfo *debug.BuildInfo

BuildInfo contains the build info for the application

View Source
var BuildSettings map[string]string

BuildSettings contains the build settings for the application

View Source
var DefaultServiceOptions = ServiceOptions{}

DefaultServiceOptions specifies the default values of service options, used when no ServiceOptions instance is provided to NewService.

View Source
var Disabled = u.False

Disabled means the feature should be disabled

View Source
var Enabled = u.True

Enabled means the feature should be enabled

View Source
var MacTitleBarDefault = MacTitleBar{
	AppearsTransparent:   false,
	Hide:                 false,
	HideTitle:            false,
	FullSizeContent:      false,
	UseToolbar:           false,
	HideToolbarSeparator: false,
}

MacTitleBarDefault results in the default Mac MacTitleBar

View Source
var MacTitleBarHidden = MacTitleBar{
	AppearsTransparent:   true,
	Hide:                 false,
	HideTitle:            true,
	FullSizeContent:      true,
	UseToolbar:           false,
	HideToolbarSeparator: false,
}

MacTitleBarHidden results in a hidden title bar and a full size content window, yet the title bar still has the standard window controls (“traffic lights”) in the top left.

View Source
var MacTitleBarHiddenInset = MacTitleBar{
	AppearsTransparent:   true,
	Hide:                 false,
	HideTitle:            true,
	FullSizeContent:      true,
	UseToolbar:           true,
	HideToolbarSeparator: true,
}

MacTitleBarHiddenInset results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.

View Source
var MacTitleBarHiddenInsetUnified = MacTitleBar{
	AppearsTransparent:   true,
	Hide:                 false,
	HideTitle:            true,
	FullSizeContent:      true,
	UseToolbar:           true,
	HideToolbarSeparator: true,
	ToolbarStyle:         MacToolbarStyleUnified,
}

MacTitleBarHiddenInsetUnified results in a hidden title bar with an alternative look where the traffic light buttons are even more inset from the window edge.

View Source
var VirtualKeyCodes = map[uint]string{}/* 146 elements not displayed */

Functions

func AssetFileServerFS

func AssetFileServerFS(assets fs.FS) http.Handler

AssetFileServerFS returns a http handler which serves the assets from the fs.FS. If an external devserver has been provided 'FRONTEND_DEVSERVER_URL' the files are being served from the external server, ignoring the `assets`.

func BundledAssetFileServer

func BundledAssetFileServer(assets fs.FS) http.Handler

BundledAssetFileServer returns a http handler which serves the assets from the fs.FS. If an external devserver has been provided 'FRONTEND_DEVSERVER_URL' the files are being served from the external server, ignoring the `assets`. It also serves the compiled runtime.js file at `/wails/runtime.js`. It will provide the production runtime.js file from the embedded assets if the `production` tag is used.

func DefaultLogger

func DefaultLogger(level slog.Leveler) *slog.Logger

func Fatal

func Fatal(message string, args ...any)

func InvokeAsync

func InvokeAsync(fn func())

func InvokeSync

func InvokeSync(fn func())

func InvokeSyncWithError

func InvokeSyncWithError(fn func() error) (err error)

func InvokeSyncWithResult

func InvokeSyncWithResult[T any](fn func() T) (res T)

func InvokeSyncWithResultAndError

func InvokeSyncWithResultAndError[T any](fn func() (T, error)) (res T, err error)

func InvokeSyncWithResultAndOther

func InvokeSyncWithResultAndOther[T any, U any](fn func() (T, U)) (res T, other U)

func NewRGBPtr

func NewRGBPtr(red, green, blue uint8) *uint32

func Path

func Path(selector PathType) string

Path returns the path for the given selector

func Paths

func Paths(selector PathTypes) []string

Paths returns the paths for the given selector

func RegisterEvent

func RegisterEvent[Data any](name string)

RegisterEvent registers a custom event name and associated data type. Events may be registered at most once. Duplicate calls for the same event name trigger a panic.

The binding generator emits typing information for all registered custom events. [App.EmitEvent] and [Window.EmitEvent] check the data type for registered events. Data types are matched exactly and no conversion is performed.

It is recommended to call RegisterEvent directly, with constant arguments, and only from init functions. Indirect calls or instantiations are not discoverable by the binding generator.

func ToARGB

func ToARGB(img *image.RGBA) (int, int, []byte)

func ValidateAndSanitizeURL

func ValidateAndSanitizeURL(rawURL string) (string, error)

Types

type ActivationPolicy

type ActivationPolicy int

ActivationPolicy is the activation policy for the application.

const (
	// ActivationPolicyRegular is used for applications that have a user interface,
	ActivationPolicyRegular ActivationPolicy = iota
	// ActivationPolicyAccessory is used for applications that do not have a main window,
	// such as system tray applications or background applications.
	ActivationPolicyAccessory
	ActivationPolicyProhibited
)

type Alignment

type Alignment int
const (
	TOP Alignment = iota
	RIGHT
	BOTTOM
	LEFT
)

type AndroidOptions

type AndroidOptions struct {
	// DisableScroll disables scrolling in the WebView
	DisableScroll bool

	// DisableBounce disables the overscroll bounce effect
	DisableOverscroll bool

	// EnableZoom allows pinch-to-zoom in the WebView (default: false)
	EnableZoom bool

	// UserAgent sets a custom user agent string
	UserAgent string

	// BackgroundColour sets the background colour of the WebView
	BackgroundColour RGBA

	// DisableHardwareAcceleration disables hardware acceleration for the WebView
	DisableHardwareAcceleration bool
}

AndroidOptions contains options for Android applications.

type App

type App struct {

	// Manager pattern for organized API
	Window      *WindowManager
	ContextMenu *ContextMenuManager
	KeyBinding  *KeyBindingManager
	Browser     *BrowserManager
	Env         *EnvironmentManager
	Dialog      *DialogManager
	Event       *EventManager
	Menu        *MenuManager
	Screen      *ScreenManager
	Clipboard   *ClipboardManager
	SystemTray  *SystemTrayManager

	Logger *slog.Logger
	// contains filtered or unexported fields
}

func Get

func Get() *App

func New

func New(appOptions Options) *App

func (*App) Capabilities

func (a *App) Capabilities() capabilities.Capabilities

func (*App) Config

func (a *App) Config() Options

func (*App) Context

func (a *App) Context() context.Context

Context returns the application context that is canceled when the application shuts down. This context should be used for graceful shutdown of goroutines and long-running operations.

func (*App) GetPID

func (a *App) GetPID() int

func (*App) Hide

func (a *App) Hide()

func (*App) NewMenu

func (a *App) NewMenu() *Menu

func (*App) OnShutdown

func (a *App) OnShutdown(f func())

OnShutdown adds a function to be run when the application is shutting down.

func (*App) Quit

func (a *App) Quit()

func (*App) RegisterService

func (a *App) RegisterService(service Service)

RegisterService appends the given service to the list of bound services. Registered services will be bound and initialised in registration order upon calling App.Run.

RegisterService will log an error message and discard the given service if called after App.Run.

func (*App) Run

func (a *App) Run() error

func (*App) SetIcon

func (a *App) SetIcon(icon []byte)

func (*App) Show

func (a *App) Show()

type ApplicationEvent

type ApplicationEvent struct {
	Id uint
	// contains filtered or unexported fields
}

func (*ApplicationEvent) Cancel

func (w *ApplicationEvent) Cancel()

func (*ApplicationEvent) Context

func (*ApplicationEvent) IsCancelled

func (w *ApplicationEvent) IsCancelled() bool

type ApplicationEventContext

type ApplicationEventContext struct {
	// contains filtered or unexported fields
}

ApplicationEventContext is the context of an application event

func (ApplicationEventContext) Filename

func (c ApplicationEventContext) Filename() string

Filename returns the filename from the event context if it was set

func (ApplicationEventContext) HasVisibleWindows

func (c ApplicationEventContext) HasVisibleWindows() bool

HasVisibleWindows returns true if the event context has a visible window

func (ApplicationEventContext) IsDarkMode

func (c ApplicationEventContext) IsDarkMode() bool

IsDarkMode returns true if the event context has a dark mode

func (ApplicationEventContext) OpenedFiles

func (c ApplicationEventContext) OpenedFiles() []string

OpenedFiles returns the opened files from the event context if it was set

func (ApplicationEventContext) URL

URL returns the URL from the event context if it was set

type Args

type Args struct {
	// contains filtered or unexported fields
}

func (*Args) AsMap

func (a *Args) AsMap() *MapArgs

func (*Args) String

func (a *Args) String() string

func (*Args) ToStruct

func (a *Args) ToStruct(str any) error

func (*Args) UnmarshalJSON

func (a *Args) UnmarshalJSON(data []byte) error

type AssetOptions

type AssetOptions struct {
	// Handler which serves all the content to the WebView.
	Handler http.Handler

	// Middleware is a HTTP Middleware which allows to hook into the AssetServer request chain. It allows to skip the default
	// request handler dynamically, e.g. implement specialized Routing etc.
	// The Middleware is called to build a new `http.Handler` used by the AssetSever and it also receives the default
	// handler used by the AssetServer as an argument.
	//
	// This middleware injects itself before any of Wails internal middlewares.
	//
	// If not defined, the default AssetServer request chain is executed.
	//
	// Multiple Middlewares can be chained together with:
	//   ChainMiddleware(middleware ...Middleware) Middleware
	Middleware Middleware

	// DisableLogging disables logging of the AssetServer. By default, the AssetServer logs every request.
	DisableLogging bool
}

AssetOptions defines the configuration of the AssetServer.

type AssetServerTransport

type AssetServerTransport interface {
	Transport

	// ServeAssets configures the transport to serve assets.
	// The assetHandler is Wails' internal asset server that handles:
	//   - All static assets (HTML, CSS, JS, images, etc.)
	//   - /wails/runtime.js - The Wails runtime library
	//
	// The transport should integrate this handler into its HTTP server.
	// Typically this means mounting it at "/" and ensuring the IPC endpoint
	// (e.g., /wails/ws for WebSocket) is handled separately.
	//
	// This method is called after Start() completes successfully.
	ServeAssets(assetHandler http.Handler) error
}

AssetServerTransport is an optional interface that transports can implement to serve assets over HTTP, enabling browser-based deployments.

When a transport implements this interface, Wails will call ServeAssets() after Start() to provide the asset server handler. The transport should integrate this handler into its HTTP server to serve HTML, CSS, JS, and other static assets alongside the IPC transport.

This is useful for:

  • Running Wails apps in a browser instead of a webview
  • Exposing the app over a network
  • Custom server configurations with both assets and IPC

type BackdropType

type BackdropType int32
const (
	Auto    BackdropType = 0
	None    BackdropType = 1
	Mica    BackdropType = 2
	Acrylic BackdropType = 3
	Tabbed  BackdropType = 4
)

type BackgroundType

type BackgroundType int
const (
	BackgroundTypeSolid BackgroundType = iota
	BackgroundTypeTransparent
	BackgroundTypeTranslucent
)

type Bindings

type Bindings struct {
	// contains filtered or unexported fields
}

func NewBindings

func NewBindings(marshalError func(error) []byte, aliases map[uint32]uint32) *Bindings

func (*Bindings) Add

func (b *Bindings) Add(service Service) error

Add adds the given service to the bindings.

func (*Bindings) Get

func (b *Bindings) Get(options *CallOptions) *BoundMethod

Get returns the bound method with the given name

func (*Bindings) GetByID

func (b *Bindings) GetByID(id uint32) *BoundMethod

GetByID returns the bound method with the given ID

type BoundMethod

type BoundMethod struct {
	Method   reflect.Value `json:"-"`
	Name     string        `json:"name"`
	FQN      string        `json:"-"`
	Comments string        `json:"comments,omitempty"`
	Inputs   []*Parameter  `json:"inputs,omitempty"`
	Outputs  []*Parameter  `json:"outputs,omitempty"`

	ID uint32 `json:"id"`
	// contains filtered or unexported fields
}

BoundMethod defines all the data related to a Go method that is bound to the Wails application. Field order is optimized to minimize struct padding (136 bytes vs 144 bytes).

func (*BoundMethod) Call

func (b *BoundMethod) Call(ctx context.Context, args []json.RawMessage) (result any, err error)

Call will attempt to call this bound method with the given args. If the call succeeds, result will be either a non-error return value (if there is only one) or a slice of non-error return values (if there are more than one).

If the arguments are mistyped or the call returns one or more non-nil error values, result is nil and err is an instance of *CallError.

func (*BoundMethod) String

func (b *BoundMethod) String() string

type BrowserManager

type BrowserManager struct {
	// contains filtered or unexported fields
}

BrowserManager manages browser-related operations

func (*BrowserManager) OpenFile

func (bm *BrowserManager) OpenFile(path string) error

OpenFile opens a file in the default browser

func (*BrowserManager) OpenURL

func (bm *BrowserManager) OpenURL(url string) error

OpenURL opens a URL in the default browser

type Button

type Button struct {
	Label     string
	IsCancel  bool
	IsDefault bool
	Callback  func()
}

func (*Button) OnClick

func (b *Button) OnClick(callback func()) *Button

func (*Button) SetAsCancel

func (b *Button) SetAsCancel() *Button

func (*Button) SetAsDefault

func (b *Button) SetAsDefault() *Button

type ButtonState

type ButtonState int
const (
	ButtonEnabled  ButtonState = 0
	ButtonDisabled ButtonState = 1
	ButtonHidden   ButtonState = 2
)

type CallError

type CallError struct {
	Message string    `json:"message"`
	Cause   any       `json:"cause,omitempty"`
	Kind    ErrorKind `json:"kind"`
}

CallError represents an error that occurred during a method call. Field order is optimized to minimize struct padding.

func (*CallError) Error

func (e *CallError) Error() string

type CallOptions

type CallOptions struct {
	MethodName string            `json:"methodName"`
	Args       []json.RawMessage `json:"args"`
	MethodID   uint32            `json:"methodID"`
}

CallOptions defines the options for a method call. Field order is optimized to minimize struct padding.

type Calloc

type Calloc struct {
	// contains filtered or unexported fields
}

Calloc handles alloc/dealloc of C data

func NewCalloc

func NewCalloc() Calloc

NewCalloc creates a new allocator

func (Calloc) Free

func (c Calloc) Free()

Free frees all allocated C memory

func (Calloc) String

func (c Calloc) String(in string) *C.char

String creates a new C string and retains a reference to it

type Clipboard

type Clipboard struct {
	// contains filtered or unexported fields
}

func (*Clipboard) SetText

func (c *Clipboard) SetText(text string) bool

func (*Clipboard) Text

func (c *Clipboard) Text() (string, bool)

type ClipboardManager

type ClipboardManager struct {
	// contains filtered or unexported fields
}

ClipboardManager manages clipboard operations

func (*ClipboardManager) SetText

func (cm *ClipboardManager) SetText(text string) bool

SetText sets text in the clipboard

func (*ClipboardManager) Text

func (cm *ClipboardManager) Text() (string, bool)

Text gets text from the clipboard

type Context

type Context struct {
	// contains filtered or unexported fields
}

func (*Context) ClickedMenuItem

func (c *Context) ClickedMenuItem() *MenuItem

func (*Context) ContextMenuData

func (c *Context) ContextMenuData() string

func (*Context) IsChecked

func (c *Context) IsChecked() bool

type ContextMenu

type ContextMenu struct {
	*Menu
	// contains filtered or unexported fields
}

func NewContextMenu

func NewContextMenu(name string) *ContextMenu

func (*ContextMenu) Destroy

func (m *ContextMenu) Destroy()

func (*ContextMenu) Update

func (m *ContextMenu) Update()

type ContextMenuData

type ContextMenuData struct {
	Id   string `json:"id"`
	X    int    `json:"x"`
	Y    int    `json:"y"`
	Data string `json:"data"`
}

type ContextMenuManager

type ContextMenuManager struct {
	// contains filtered or unexported fields
}

ContextMenuManager manages all context menu operations

func (*ContextMenuManager) Add

func (cmm *ContextMenuManager) Add(name string, menu *ContextMenu)

Add adds a context menu (replaces Register for consistency)

func (*ContextMenuManager) Get

func (cmm *ContextMenuManager) Get(name string) (*ContextMenu, bool)

Get retrieves a context menu by name

func (*ContextMenuManager) GetAll

func (cmm *ContextMenuManager) GetAll() []*ContextMenu

GetAll returns all registered context menus as a slice

func (*ContextMenuManager) New

func (cmm *ContextMenuManager) New() *ContextMenu

New creates a new context menu

func (*ContextMenuManager) Remove

func (cmm *ContextMenuManager) Remove(name string)

Remove removes a context menu by name (replaces Unregister for consistency)

type CoreWebView2PermissionKind

type CoreWebView2PermissionKind uint32
const (
	CoreWebView2PermissionKindUnknownPermission CoreWebView2PermissionKind = iota
	CoreWebView2PermissionKindMicrophone
	CoreWebView2PermissionKindCamera
	CoreWebView2PermissionKindGeolocation
	CoreWebView2PermissionKindNotifications
	CoreWebView2PermissionKindOtherSensors
	CoreWebView2PermissionKindClipboardRead
)

type CoreWebView2PermissionState

type CoreWebView2PermissionState uint32
const (
	CoreWebView2PermissionStateDefault CoreWebView2PermissionState = iota
	CoreWebView2PermissionStateAllow
	CoreWebView2PermissionStateDeny
)

type CustomEvent

type CustomEvent struct {
	Name string `json:"name"`
	Data any    `json:"data"`

	// Sender records the name of the window sending the event,
	// or "" if sent from application.
	Sender string `json:"sender,omitempty"`
	// contains filtered or unexported fields
}

func (*CustomEvent) Cancel

func (e *CustomEvent) Cancel()

func (*CustomEvent) IsCancelled

func (e *CustomEvent) IsCancelled() bool

func (*CustomEvent) ToJSON

func (e *CustomEvent) ToJSON() string

type DialogManager

type DialogManager struct {
	// contains filtered or unexported fields
}

DialogManager manages dialog-related operations

func (*DialogManager) Error

func (dm *DialogManager) Error() *MessageDialog

Error creates an error dialog

func (*DialogManager) Info

func (dm *DialogManager) Info() *MessageDialog

Info creates an information dialog

func (*DialogManager) OpenFile

func (dm *DialogManager) OpenFile() *OpenFileDialogStruct

OpenFile creates a file dialog for selecting files

func (*DialogManager) OpenFileWithOptions

func (dm *DialogManager) OpenFileWithOptions(options *OpenFileDialogOptions) *OpenFileDialogStruct

OpenFileWithOptions creates a file dialog with options

func (*DialogManager) Question

func (dm *DialogManager) Question() *MessageDialog

Question creates a question dialog

func (*DialogManager) SaveFile

func (dm *DialogManager) SaveFile() *SaveFileDialogStruct

SaveFile creates a save file dialog

func (*DialogManager) SaveFileWithOptions

func (dm *DialogManager) SaveFileWithOptions(options *SaveFileDialogOptions) *SaveFileDialogStruct

SaveFileWithOptions creates a save file dialog with options

func (*DialogManager) Warning

func (dm *DialogManager) Warning() *MessageDialog

Warning creates a warning dialog

type DialogType

type DialogType int
const (
	InfoDialogType DialogType = iota
	QuestionDialogType
	WarningDialogType
	ErrorDialogType
)

type DropTargetDetails

type DropTargetDetails struct {
	X          int               `json:"x"`
	Y          int               `json:"y"`
	ElementID  string            `json:"id"`
	ClassList  []string          `json:"classList"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

DropTargetDetails contains information about the HTML element where files were dropped (the element with data-file-drop-target attribute).

type ElementDetailsPayload

type ElementDetailsPayload struct {
	ID         string            `json:"id"`
	ClassList  []string          `json:"classList"`
	Attributes map[string]string `json:"attributes"`
}

ElementDetailsPayload holds detailed information about the drop target element.

type EnvironmentInfo

type EnvironmentInfo struct {
	OS           string
	Arch         string
	Debug        bool
	OSInfo       *operatingsystem.OS
	PlatformInfo map[string]any
}

EnvironmentInfo represents information about the current environment.

Fields: - OS: the operating system that the program is running on. - Arch: the architecture of the operating system. - Debug: indicates whether debug mode is enabled. - OSInfo: information about the operating system.

type EnvironmentManager

type EnvironmentManager struct {
	// contains filtered or unexported fields
}

EnvironmentManager manages environment-related operations

func (*EnvironmentManager) GetAccentColor

func (em *EnvironmentManager) GetAccentColor() string

GetAccentColor returns the system accent color

func (*EnvironmentManager) Info

Info returns environment information

func (*EnvironmentManager) IsDarkMode

func (em *EnvironmentManager) IsDarkMode() bool

IsDarkMode returns true if the system is in dark mode

func (*EnvironmentManager) OpenFileManager

func (em *EnvironmentManager) OpenFileManager(path string, selectFile bool) error

OpenFileManager opens the file manager at the specified path, optionally selecting the file

type ErrorKind

type ErrorKind string
const (
	ReferenceError ErrorKind = "ReferenceError"
	TypeError      ErrorKind = "TypeError"
	RuntimeError   ErrorKind = "RuntimeError"
)

type EventIPCTransport

type EventIPCTransport struct {
	// contains filtered or unexported fields
}

func (*EventIPCTransport) DispatchWailsEvent

func (t *EventIPCTransport) DispatchWailsEvent(event *CustomEvent)

type EventListener

type EventListener struct {
	// contains filtered or unexported fields
}

type EventManager

type EventManager struct {
	// contains filtered or unexported fields
}

EventManager manages event-related operations

func (*EventManager) Emit

func (em *EventManager) Emit(name string, data ...any) bool

Emit emits a custom event with the specified name and associated data. It returns a boolean indicating whether the event was cancelled by a hook.

If no data argument is provided, Emit emits an event with nil data. When there is exactly one data argument, it will be used as the custom event's data field. When more than one argument is provided, the event's data field will be set to the argument slice.

If the given event name is registered, Emit validates the data parameter against the expected data type. In case of a mismatch, Emit reports an error to the registered error handler for the application and cancels the event.

func (*EventManager) EmitEvent

func (em *EventManager) EmitEvent(event *CustomEvent) bool

EmitEvent emits a custom event object (internal use) It returns a boolean indicating whether the event was cancelled by a hook.

If the given event name is registered, emitEvent validates the data parameter against the expected data type. In case of a mismatch, emitEvent reports an error to the registered error handler for the application and cancels the event.

func (*EventManager) Off

func (em *EventManager) Off(name string)

Off removes all listeners for a custom event

func (*EventManager) On

func (em *EventManager) On(name string, callback func(event *CustomEvent)) func()

On registers a listener for custom events

func (*EventManager) OnApplicationEvent

func (em *EventManager) OnApplicationEvent(eventType events.ApplicationEventType, callback func(event *ApplicationEvent)) func()

OnApplicationEvent registers a listener for application events

func (*EventManager) OnMultiple

func (em *EventManager) OnMultiple(name string, callback func(event *CustomEvent), counter int)

OnMultiple registers a listener for custom events that will be called N times

func (*EventManager) RegisterApplicationEventHook

func (em *EventManager) RegisterApplicationEventHook(eventType events.ApplicationEventType, callback func(event *ApplicationEvent)) func()

RegisterApplicationEventHook registers an application event hook

func (*EventManager) Reset

func (em *EventManager) Reset()

Reset removes all custom event listeners

type EventProcessor

type EventProcessor struct {
	// contains filtered or unexported fields
}

EventProcessor handles custom events

func NewWailsEventProcessor

func NewWailsEventProcessor(dispatchEventToWindows func(*CustomEvent)) *EventProcessor

func (*EventProcessor) Emit

func (e *EventProcessor) Emit(thisEvent *CustomEvent) error

Emit sends an event to all listeners.

If the event is globally registered, it validates associated data against the expected data type. In case of mismatches, it cancels the event and returns an error.

func (*EventProcessor) Off

func (e *EventProcessor) Off(eventName string)

func (*EventProcessor) OffAll

func (e *EventProcessor) OffAll()

func (*EventProcessor) On

func (e *EventProcessor) On(eventName string, callback func(event *CustomEvent)) func()

On is the equivalent of Javascript's `addEventListener`

func (*EventProcessor) OnMultiple

func (e *EventProcessor) OnMultiple(eventName string, callback func(event *CustomEvent), counter int) func()

OnMultiple is the same as `OnApplicationEvent` but will unregister after `count` events

func (*EventProcessor) Once

func (e *EventProcessor) Once(eventName string, callback func(event *CustomEvent)) func()

Once is the same as `OnApplicationEvent` but will unregister after the first event

func (*EventProcessor) RegisterHook

func (e *EventProcessor) RegisterHook(eventName string, callback func(*CustomEvent)) func()

RegisterHook provides a means of registering methods to be called before emitting the event

type FatalError

type FatalError struct {
	// contains filtered or unexported fields
}

FatalError instances are passed to the registered error handler in case of catastrophic, unrecoverable failures that require immediate termination. FatalError wraps the original error value in an informative message. The underlying error may be retrieved through the FatalError.Unwrap method.

func (*FatalError) Error

func (e *FatalError) Error() string

func (*FatalError) Internal

func (e *FatalError) Internal() bool

Internal returns true when the error was triggered from wails' internal code.

func (*FatalError) Unwrap

func (e *FatalError) Unwrap() error

Unwrap returns the original cause of the fatal error, for easy inspection using the errors.As API.

type FileFilter

type FileFilter struct {
	DisplayName string // Filter information EG: "Image Files (*.jpg, *.png)"
	Pattern     string // semicolon separated list of extensions, EG: "*.jpg;*.png"
}

type GSList

type GSList C.GSList

type GSListPointer

type GSListPointer *GSList

type HTTPTransport

type HTTPTransport struct {
	// contains filtered or unexported fields
}

func NewHTTPTransport

func NewHTTPTransport(opts ...HTTPTransportOption) *HTTPTransport

func (*HTTPTransport) Handler

func (t *HTTPTransport) Handler() func(next http.Handler) http.Handler

func (*HTTPTransport) JSClient

func (t *HTTPTransport) JSClient() []byte

func (*HTTPTransport) Start

func (t *HTTPTransport) Start(ctx context.Context, processor *MessageProcessor) error

func (*HTTPTransport) Stop

func (t *HTTPTransport) Stop() error

type HTTPTransportOption

type HTTPTransportOption func(*HTTPTransport)

HTTPTransportOption is a functional option for configuring HTTPTransport

func HTTPTransportWithLogger

func HTTPTransportWithLogger(logger *slog.Logger) HTTPTransportOption

HTTPTransportWithLogger is a functional option to set the logger for HTTPTransport.

type IOSOptions

type IOSOptions struct {
	// DisableInputAccessoryView controls whether the iOS WKWebView shows the
	// input accessory toolbar (the bar with Next/Previous/Done) above the keyboard.
	// Default: false (accessory bar is shown).
	// true  => accessory view is disabled/hidden
	// false => accessory view is enabled/shown
	DisableInputAccessoryView bool

	// Scrolling & Bounce (defaults: scroll/bounce/indicators are enabled on iOS)
	// Use Disable* to keep default true behavior without surprising zero-values.
	DisableScroll           bool
	DisableBounce           bool
	DisableScrollIndicators bool

	// Navigation gestures (default false)
	EnableBackForwardNavigationGestures bool

	// Link previews (default true on iOS)
	// Use Disable* so default (false) means previews are enabled.
	DisableLinkPreview bool

	// Media playback
	// Inline playback (default false) -> Enable*
	EnableInlineMediaPlayback bool
	// Autoplay without user action (default false) -> Enable*
	EnableAutoplayWithoutUserAction bool

	// Inspector / Debug (default true in dev)
	// Use Disable* so default (false) keeps inspector enabled.
	DisableInspectable bool

	// User agent customization
	// If empty, defaults apply. ApplicationNameForUserAgent defaults to "wails.io".
	UserAgent                   string
	ApplicationNameForUserAgent string

	// App-wide background colour for the main iOS window prior to any WebView creation.
	// If AppBackgroundColourSet is true, the delegate will apply this colour to the app window
	// during didFinishLaunching. Otherwise, it defaults to white.
	AppBackgroundColourSet bool
	BackgroundColour       RGBA

	// EnableNativeTabs enables a native iOS UITabBar at the bottom of the screen.
	// When enabled, the native tab bar will dispatch a 'nativeTabSelected' CustomEvent
	// to the window with detail: { index: number }.
	// NOTE: If NativeTabsItems has one or more entries, native tabs are auto-enabled
	// regardless of this flag, and the provided items will be used.
	EnableNativeTabs bool

	// NativeTabsItems configures the labels and optional SF Symbol icons for the
	// native UITabBar. If one or more items are provided, native tabs are automatically
	// enabled. If empty and EnableNativeTabs is true, default items are used.
	NativeTabsItems []NativeTabItem
}

IOSOptions contains options for iOS applications.

type IconPosition

type IconPosition int

type KeyBinding

type KeyBinding struct {
	Accelerator string
	Callback    func(window Window)
}

KeyBinding represents a key binding with its accelerator and callback

type KeyBindingManager

type KeyBindingManager struct {
	// contains filtered or unexported fields
}

KeyBindingManager manages all key binding operations

func (*KeyBindingManager) Add

func (kbm *KeyBindingManager) Add(accelerator string, callback func(window Window))

Add adds a key binding

func (*KeyBindingManager) GetAll

func (kbm *KeyBindingManager) GetAll() []*KeyBinding

GetAll returns all registered key bindings as a slice

func (*KeyBindingManager) Process

func (kbm *KeyBindingManager) Process(accelerator string, window Window) bool

Process processes a key binding and returns true if handled

func (*KeyBindingManager) Remove

func (kbm *KeyBindingManager) Remove(accelerator string)

Remove removes a key binding

type LRTB

type LRTB struct {
	Left   int
	Right  int
	Top    int
	Bottom int
}

LRTB is a struct that holds Left, Right, Top, Bottom values

type LinuxOptions

type LinuxOptions struct {
	// DisableQuitOnLastWindowClosed disables the auto quit of the application if the last window has been closed.
	DisableQuitOnLastWindowClosed bool

	// ProgramName is used to set the program's name for the window manager via GTK's g_set_prgname().
	//This name should not be localized. [see the docs]
	//
	//When a .desktop file is created this value helps with window grouping and desktop icons when the .desktop file's Name
	//property differs form the executable's filename.
	//
	//[see the docs]: https://docs.gtk.org/glib/func.set_prgname.html
	ProgramName string
}

LinuxOptions contains options for Linux applications.

type LinuxWindow

type LinuxWindow struct {
	// Icon Sets up the icon representing the window. This icon is used when the window is minimized
	// (also known as iconified).
	Icon []byte

	// WindowIsTranslucent sets the window's background to transparent when enabled.
	WindowIsTranslucent bool

	// WebviewGpuPolicy used for determining the hardware acceleration policy for the webview.
	//   - WebviewGpuPolicyAlways
	//   - WebviewGpuPolicyOnDemand
	//   - WebviewGpuPolicyNever
	//
	// Due to https://github.com/wailsapp/wails/issues/2977, if options.Linux is nil
	// in the call to wails.Run(), WebviewGpuPolicy is set by default to WebviewGpuPolicyNever.
	// Client code may override this behavior by passing a non-nil Options and set
	// WebviewGpuPolicy as needed.
	WebviewGpuPolicy WebviewGpuPolicy

	// WindowDidMoveDebounceMS is the debounce time in milliseconds for the WindowDidMove event
	WindowDidMoveDebounceMS uint16

	// Menu is the window's menu
	Menu *Menu
}

LinuxWindow specific to Linux windows

type MacAppearanceType

type MacAppearanceType string

MacAppearanceType is a type of Appearance for Cocoa windows

const (
	// DefaultAppearance uses the default system value
	DefaultAppearance MacAppearanceType = ""
	// NSAppearanceNameAqua - The standard light system appearance.
	NSAppearanceNameAqua MacAppearanceType = "NSAppearanceNameAqua"
	// NSAppearanceNameDarkAqua - The standard dark system appearance.
	NSAppearanceNameDarkAqua MacAppearanceType = "NSAppearanceNameDarkAqua"
	// NSAppearanceNameVibrantLight - The light vibrant appearance
	NSAppearanceNameVibrantLight MacAppearanceType = "NSAppearanceNameVibrantLight"
	// NSAppearanceNameAccessibilityHighContrastAqua - A high-contrast version of the standard light system appearance.
	NSAppearanceNameAccessibilityHighContrastAqua MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastAqua"
	// NSAppearanceNameAccessibilityHighContrastDarkAqua - A high-contrast version of the standard dark system appearance.
	NSAppearanceNameAccessibilityHighContrastDarkAqua MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastDarkAqua"
	// NSAppearanceNameAccessibilityHighContrastVibrantLight - A high-contrast version of the light vibrant appearance.
	NSAppearanceNameAccessibilityHighContrastVibrantLight MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastVibrantLight"
	// NSAppearanceNameAccessibilityHighContrastVibrantDark - A high-contrast version of the dark vibrant appearance.
	NSAppearanceNameAccessibilityHighContrastVibrantDark MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastVibrantDark"
)

type MacBackdrop

type MacBackdrop int

MacBackdrop is the backdrop type for macOS

const (
	// MacBackdropNormal - The default value. The window will have a normal opaque background.
	MacBackdropNormal MacBackdrop = iota
	// MacBackdropTransparent - The window will have a transparent background, with the content underneath it being visible
	MacBackdropTransparent
	// MacBackdropTranslucent - The window will have a translucent background, with the content underneath it being "fuzzy" or "frosted"
	MacBackdropTranslucent
	// MacBackdropLiquidGlass - The window will use Apple's Liquid Glass effect (macOS 15.0+ with fallback to translucent)
	MacBackdropLiquidGlass
)

type MacLiquidGlass

type MacLiquidGlass struct {
	// Style of the glass effect
	Style MacLiquidGlassStyle

	// Material to use for NSVisualEffectView (when NSGlassEffectView is not available)
	// Set to NSVisualEffectMaterialAuto to use automatic selection based on Style
	Material NSVisualEffectMaterial

	// Corner radius for the glass effect (0 for square corners)
	CornerRadius float64

	// Tint color for the glass (optional, nil for no tint)
	TintColor *RGBA

	// Group identifier for merging multiple glass windows
	GroupID string

	// Spacing between grouped glass elements (in points)
	GroupSpacing float64
}

MacLiquidGlass contains configuration for the Liquid Glass effect

type MacLiquidGlassStyle

type MacLiquidGlassStyle int

MacLiquidGlassStyle defines the style of the Liquid Glass effect

const (
	// LiquidGlassStyleAutomatic - System determines the best style
	LiquidGlassStyleAutomatic MacLiquidGlassStyle = iota
	// LiquidGlassStyleLight - Light glass appearance
	LiquidGlassStyleLight
	// LiquidGlassStyleDark - Dark glass appearance
	LiquidGlassStyleDark
	// LiquidGlassStyleVibrant - Vibrant glass with enhanced effects
	LiquidGlassStyleVibrant
)

type MacOptions

type MacOptions struct {
	// ActivationPolicy is the activation policy for the application. Defaults to
	// applicationActivationPolicyRegular.
	ActivationPolicy ActivationPolicy
	// If set to true, the application will terminate when the last window is closed.
	ApplicationShouldTerminateAfterLastWindowClosed bool
}

MacOptions contains options for macOS applications.

type MacTitleBar

type MacTitleBar struct {
	// AppearsTransparent will make the titlebar transparent
	AppearsTransparent bool
	// Hide will hide the titlebar
	Hide bool
	// HideTitle will hide the title
	HideTitle bool
	// FullSizeContent will extend the window content to the full size of the window
	FullSizeContent bool
	// UseToolbar will use a toolbar instead of a titlebar
	UseToolbar bool
	// HideToolbarSeparator will hide the toolbar separator
	HideToolbarSeparator bool
	// ShowToolbarWhenFullscreen will keep the toolbar visible when the window is in fullscreen mode
	ShowToolbarWhenFullscreen bool
	// ToolbarStyle is the style of toolbar to use
	ToolbarStyle MacToolbarStyle
}

MacTitleBar contains options for the Mac titlebar

type MacToolbarStyle

type MacToolbarStyle int

MacToolbarStyle is the style of toolbar for macOS

const (
	// MacToolbarStyleAutomatic - The default value. The style will be determined by the window's given configuration
	MacToolbarStyleAutomatic MacToolbarStyle = iota
	// MacToolbarStyleExpanded - The toolbar will appear below the window title
	MacToolbarStyleExpanded
	// MacToolbarStylePreference - The toolbar will appear below the window title and the items in the toolbar will attempt to have equal widths when possible
	MacToolbarStylePreference
	// MacToolbarStyleUnified - The window title will appear inline with the toolbar when visible
	MacToolbarStyleUnified
	// MacToolbarStyleUnifiedCompact - Same as MacToolbarStyleUnified, but with reduced margins in the toolbar allowing more focus to be on the contents of the window
	MacToolbarStyleUnifiedCompact
)

type MacWebviewPreferences

type MacWebviewPreferences struct {
	// TabFocusesLinks will enable tabbing to links
	TabFocusesLinks u.Bool
	// TextInteractionEnabled will enable text interaction
	TextInteractionEnabled u.Bool
	// FullscreenEnabled will enable fullscreen
	FullscreenEnabled u.Bool
	// AllowsBackForwardNavigationGestures enables horizontal swipe gestures for back/forward navigation
	AllowsBackForwardNavigationGestures u.Bool
}

MacWebviewPreferences contains preferences for the Mac webview

type MacWindow

type MacWindow struct {
	// Backdrop is the backdrop type for the window
	Backdrop MacBackdrop
	// DisableShadow will disable the window shadow
	DisableShadow bool
	// TitleBar contains options for the Mac titlebar
	TitleBar MacTitleBar
	// Appearance is the appearance type for the window
	Appearance MacAppearanceType
	// InvisibleTitleBarHeight defines the height of an invisible titlebar which responds to dragging
	InvisibleTitleBarHeight int
	// Maps events from platform specific to common event types
	EventMapping map[events.WindowEventType]events.WindowEventType

	// EnableFraudulentWebsiteWarnings will enable warnings for fraudulent websites.
	// Default: false
	EnableFraudulentWebsiteWarnings bool

	// WebviewPreferences contains preferences for the webview
	WebviewPreferences MacWebviewPreferences

	// WindowLevel sets the window level to control the order of windows in the screen
	WindowLevel MacWindowLevel

	// CollectionBehavior controls how the window behaves across macOS Spaces and fullscreen
	CollectionBehavior MacWindowCollectionBehavior

	// LiquidGlass contains configuration for the Liquid Glass effect
	LiquidGlass MacLiquidGlass
}

MacWindow contains macOS specific options for Webview Windows

type MacWindowCollectionBehavior

type MacWindowCollectionBehavior int

MacWindowCollectionBehavior controls window behavior across macOS Spaces and fullscreen. These correspond to NSWindowCollectionBehavior bitmask values and can be combined using bitwise OR. For example: MacWindowCollectionBehaviorCanJoinAllSpaces | MacWindowCollectionBehaviorFullScreenAuxiliary

const (
	// MacWindowCollectionBehaviorDefault is zero value - when set, FullScreenPrimary is used for backwards compatibility
	MacWindowCollectionBehaviorDefault MacWindowCollectionBehavior = 0
	// MacWindowCollectionBehaviorCanJoinAllSpaces allows window to appear on all Spaces
	MacWindowCollectionBehaviorCanJoinAllSpaces MacWindowCollectionBehavior = 1 << 0 // 1
	// MacWindowCollectionBehaviorMoveToActiveSpace moves window to active Space when shown
	MacWindowCollectionBehaviorMoveToActiveSpace MacWindowCollectionBehavior = 1 << 1 // 2
	// MacWindowCollectionBehaviorManaged is the default managed window behavior
	MacWindowCollectionBehaviorManaged MacWindowCollectionBehavior = 1 << 2 // 4
	// MacWindowCollectionBehaviorTransient marks window as temporary/transient
	MacWindowCollectionBehaviorTransient MacWindowCollectionBehavior = 1 << 3 // 8
	// MacWindowCollectionBehaviorStationary keeps window stationary during Space switches
	MacWindowCollectionBehaviorStationary MacWindowCollectionBehavior = 1 << 4 // 16
	// MacWindowCollectionBehaviorParticipatesInCycle includes window in Cmd+` cycling (default for normal windows)
	MacWindowCollectionBehaviorParticipatesInCycle MacWindowCollectionBehavior = 1 << 5 // 32
	// MacWindowCollectionBehaviorIgnoresCycle excludes window from Cmd+` cycling
	MacWindowCollectionBehaviorIgnoresCycle MacWindowCollectionBehavior = 1 << 6 // 64
	// MacWindowCollectionBehaviorFullScreenPrimary allows the window to enter fullscreen
	MacWindowCollectionBehaviorFullScreenPrimary MacWindowCollectionBehavior = 1 << 7 // 128
	// MacWindowCollectionBehaviorFullScreenAuxiliary allows window to overlay fullscreen apps
	MacWindowCollectionBehaviorFullScreenAuxiliary MacWindowCollectionBehavior = 1 << 8 // 256
	// MacWindowCollectionBehaviorFullScreenNone prevents window from entering fullscreen (macOS 10.7+)
	MacWindowCollectionBehaviorFullScreenNone MacWindowCollectionBehavior = 1 << 9 // 512
	// MacWindowCollectionBehaviorFullScreenAllowsTiling allows side-by-side tiling in fullscreen (macOS 10.11+)
	MacWindowCollectionBehaviorFullScreenAllowsTiling MacWindowCollectionBehavior = 1 << 11 // 2048
	// MacWindowCollectionBehaviorFullScreenDisallowsTiling prevents tiling in fullscreen (macOS 10.11+)
	MacWindowCollectionBehaviorFullScreenDisallowsTiling MacWindowCollectionBehavior = 1 << 12 // 4096
)

type MacWindowLevel

type MacWindowLevel string
const (
	MacWindowLevelNormal      MacWindowLevel = "normal"
	MacWindowLevelFloating    MacWindowLevel = "floating"
	MacWindowLevelTornOffMenu MacWindowLevel = "tornOffMenu"
	MacWindowLevelModalPanel  MacWindowLevel = "modalPanel"
	MacWindowLevelMainMenu    MacWindowLevel = "mainMenu"
	MacWindowLevelStatus      MacWindowLevel = "status"
	MacWindowLevelPopUpMenu   MacWindowLevel = "popUpMenu"
	MacWindowLevelScreenSaver MacWindowLevel = "screenSaver"
)

type MapArgs

type MapArgs struct {
	// contains filtered or unexported fields
}

func (*MapArgs) Bool

func (a *MapArgs) Bool(s string) *bool

func (*MapArgs) Float64

func (a *MapArgs) Float64(s string) *float64

func (*MapArgs) Int

func (a *MapArgs) Int(s string) *int

func (*MapArgs) String

func (a *MapArgs) String(key string) *string

func (*MapArgs) UInt

func (a *MapArgs) UInt(s string) *uint

func (*MapArgs) UInt8

func (a *MapArgs) UInt8(s string) *uint8
type Menu struct {
	// contains filtered or unexported fields
}

func DefaultApplicationMenu

func DefaultApplicationMenu() *Menu

func NewMenu

func NewMenu() *Menu

func NewMenuFromItems

func NewMenuFromItems(item *MenuItem, items ...*MenuItem) *Menu
func (m *Menu) Add(label string) *MenuItem
func (m *Menu) AddCheckbox(label string, enabled bool) *MenuItem
func (m *Menu) AddRadio(label string, enabled bool) *MenuItem
func (m *Menu) AddRole(role Role) *Menu
func (m *Menu) AddSeparator()
func (m *Menu) AddSubmenu(s string) *Menu
func (m *Menu) Append(in *Menu)

Append menu to an existing menu

func (m *Menu) Clear()

Clear all menu items

func (m *Menu) Clone() *Menu

Clone recursively clones the menu and all its submenus.

func (m *Menu) Destroy()
func (m *Menu) FindByLabel(label string) *MenuItem

FindByLabel recursively searches for a menu item with the given label and returns the first match, or nil if not found.

func (m *Menu) FindByRole(role Role) *MenuItem

FindByRole recursively searches for a menu item with the given role and returns the first match, or nil if not found.

func (m *Menu) ItemAt(index int) *MenuItem

ItemAt returns the menu item at the given index, or nil if the index is out of bounds.

func (m *Menu) Prepend(in *Menu)

Prepend menu before an existing menu

func (m *Menu) RemoveMenuItem(target *MenuItem)
func (m *Menu) SetLabel(label string)
func (m *Menu) Update()
type MenuBarTheme struct {
	// Default is the default theme
	Default *TextTheme

	// Hover defines the theme to use when the menu item is hovered
	Hover *TextTheme

	// Selected defines the theme to use when the menu item is selected
	Selected *TextTheme
}
type MenuItem struct {
	// contains filtered or unexported fields
}

func NewAboutMenuItem

func NewAboutMenuItem() *MenuItem

func NewAppMenu

func NewAppMenu() *MenuItem

func NewBringAllToFrontMenuItem

func NewBringAllToFrontMenuItem() *MenuItem

func NewCloseMenuItem

func NewCloseMenuItem() *MenuItem

func NewCopyMenuItem

func NewCopyMenuItem() *MenuItem

func NewCutMenuItem

func NewCutMenuItem() *MenuItem

func NewDeleteMenuItem

func NewDeleteMenuItem() *MenuItem

func NewEditMenu

func NewEditMenu() *MenuItem

func NewFileMenu

func NewFileMenu() *MenuItem

func NewFindAndReplaceMenuItem

func NewFindAndReplaceMenuItem() *MenuItem

func NewFindMenuItem

func NewFindMenuItem() *MenuItem

func NewFindNextMenuItem

func NewFindNextMenuItem() *MenuItem

func NewFindPreviousMenuItem

func NewFindPreviousMenuItem() *MenuItem

func NewForceReloadMenuItem

func NewForceReloadMenuItem() *MenuItem

func NewFrontMenuItem

func NewFrontMenuItem() *MenuItem

func NewFullScreenMenuItem

func NewFullScreenMenuItem() *MenuItem

func NewHelpMenu

func NewHelpMenu() *MenuItem

func NewHelpMenuItem

func NewHelpMenuItem() *MenuItem

func NewHideMenuItem

func NewHideMenuItem() *MenuItem

func NewHideOthersMenuItem

func NewHideOthersMenuItem() *MenuItem

func NewMenuItem

func NewMenuItem(label string) *MenuItem

func NewMenuItemCheckbox

func NewMenuItemCheckbox(label string, checked bool) *MenuItem

func NewMenuItemRadio

func NewMenuItemRadio(label string, checked bool) *MenuItem

func NewMenuItemSeparator

func NewMenuItemSeparator() *MenuItem

func NewMinimiseMenuItem

func NewMinimiseMenuItem() *MenuItem

func NewNewFileMenuItem

func NewNewFileMenuItem() *MenuItem

func NewOpenDevToolsMenuItem

func NewOpenDevToolsMenuItem() *MenuItem

func NewOpenMenuItem

func NewOpenMenuItem() *MenuItem

func NewPageLayoutMenuItem

func NewPageLayoutMenuItem() *MenuItem

func NewPasteAndMatchStyleMenuItem

func NewPasteAndMatchStyleMenuItem() *MenuItem

func NewPasteMenuItem

func NewPasteMenuItem() *MenuItem

func NewPrintMenuItem

func NewPrintMenuItem() *MenuItem

func NewQuitMenuItem

func NewQuitMenuItem() *MenuItem

func NewRedoMenuItem

func NewRedoMenuItem() *MenuItem

NewRedoMenuItem creates a new menu item for redoing the last action

func NewReloadMenuItem

func NewReloadMenuItem() *MenuItem

func NewRevertMenuItem

func NewRevertMenuItem() *MenuItem

func NewRole

func NewRole(role Role) *MenuItem

func NewSaveAsMenuItem

func NewSaveAsMenuItem() *MenuItem

func NewSaveMenuItem

func NewSaveMenuItem() *MenuItem

func NewSelectAllMenuItem

func NewSelectAllMenuItem() *MenuItem

func NewServicesMenu

func NewServicesMenu() *MenuItem

func NewShowAllMenuItem

func NewShowAllMenuItem() *MenuItem

func NewSpeechMenu

func NewSpeechMenu() *MenuItem

func NewStartSpeakingMenuItem

func NewStartSpeakingMenuItem() *MenuItem

func NewStopSpeakingMenuItem

func NewStopSpeakingMenuItem() *MenuItem

func NewSubMenuItem

func NewSubMenuItem(label string) *MenuItem

func NewSubmenu

func NewSubmenu(s string, items *Menu) *MenuItem

func NewToggleFullscreenMenuItem

func NewToggleFullscreenMenuItem() *MenuItem

func NewUndoMenuItem

func NewUndoMenuItem() *MenuItem

func NewUnhideMenuItem

func NewUnhideMenuItem() *MenuItem

func NewViewMenu

func NewViewMenu() *MenuItem

func NewWindowMenu

func NewWindowMenu() *MenuItem

func NewZoomInMenuItem

func NewZoomInMenuItem() *MenuItem

func NewZoomMenuItem

func NewZoomMenuItem() *MenuItem

func NewZoomOutMenuItem

func NewZoomOutMenuItem() *MenuItem

func NewZoomResetMenuItem

func NewZoomResetMenuItem() *MenuItem
func (m *MenuItem) Checked() bool
func (m *MenuItem) Clone() *MenuItem

Clone returns a deep copy of the MenuItem

func (m *MenuItem) Destroy()
func (m *MenuItem) Enabled() bool
func (m *MenuItem) GetAccelerator() string
func (m *MenuItem) GetSubmenu() *Menu

GetSubmenu returns the submenu of the MenuItem. If the MenuItem is not a submenu, it returns nil.

func (m *MenuItem) Hidden() bool
func (m *MenuItem) IsCheckbox() bool
func (m *MenuItem) IsRadio() bool
func (m *MenuItem) IsSeparator() bool
func (m *MenuItem) IsSubmenu() bool
func (m *MenuItem) Label() string
func (m *MenuItem) OnClick(f func(*Context)) *MenuItem
func (m *MenuItem) RemoveAccelerator()
func (m *MenuItem) SetAccelerator(shortcut string) *MenuItem
func (m *MenuItem) SetBitmap(bitmap []byte) *MenuItem
func (m *MenuItem) SetChecked(checked bool) *MenuItem
func (m *MenuItem) SetEnabled(enabled bool) *MenuItem
func (m *MenuItem) SetHidden(hidden bool) *MenuItem
func (m *MenuItem) SetLabel(s string) *MenuItem
func (m *MenuItem) SetRole(role Role) *MenuItem
func (m *MenuItem) SetTooltip(s string) *MenuItem
func (m *MenuItem) Tooltip() string
type MenuManager struct {
	// contains filtered or unexported fields
}

MenuManager manages menu-related operations

func (mm *MenuManager) GetApplicationMenu() *Menu

GetApplicationMenu returns the current application menu

func (mm *MenuManager) New() *Menu

New creates a new menu

func (mm *MenuManager) Set(menu *Menu)

Set sets the application menu

func (mm *MenuManager) SetApplicationMenu(menu *Menu)

SetApplicationMenu sets the application menu

func (mm *MenuManager) ShowAbout()

ShowAbout shows the about dialog

type MessageDialog

type MessageDialog struct {
	MessageDialogOptions
	// contains filtered or unexported fields
}

func (*MessageDialog) AddButton

func (d *MessageDialog) AddButton(s string) *Button

func (*MessageDialog) AddButtons

func (d *MessageDialog) AddButtons(buttons []*Button) *MessageDialog

func (*MessageDialog) AttachToWindow

func (d *MessageDialog) AttachToWindow(window Window) *MessageDialog

func (*MessageDialog) SetCancelButton

func (d *MessageDialog) SetCancelButton(button *Button) *MessageDialog

func (*MessageDialog) SetDefaultButton

func (d *MessageDialog) SetDefaultButton(button *Button) *MessageDialog

func (*MessageDialog) SetIcon

func (d *MessageDialog) SetIcon(icon []byte) *MessageDialog

func (*MessageDialog) SetMessage

func (d *MessageDialog) SetMessage(message string) *MessageDialog

func (*MessageDialog) SetTitle

func (d *MessageDialog) SetTitle(title string) *MessageDialog

func (*MessageDialog) Show

func (d *MessageDialog) Show()

type MessageDialogOptions

type MessageDialogOptions struct {
	DialogType DialogType
	Title      string
	Message    string
	Buttons    []*Button
	Icon       []byte
	// contains filtered or unexported fields
}

type MessageProcessor

type MessageProcessor struct {
	// contains filtered or unexported fields
}

func NewMessageProcessor

func NewMessageProcessor(logger *slog.Logger) *MessageProcessor

func (*MessageProcessor) Debug

func (m *MessageProcessor) Debug(message string, args ...any)

func (*MessageProcessor) Error

func (m *MessageProcessor) Error(message string, args ...any)

func (*MessageProcessor) HandleRuntimeCallWithIDs

func (m *MessageProcessor) HandleRuntimeCallWithIDs(ctx context.Context, req *RuntimeRequest) (resp any, err error)

type Middleware

type Middleware func(next http.Handler) http.Handler

Middleware defines HTTP middleware that can be applied to the AssetServer. The handler passed as next is the next handler in the chain. One can decide to call the next handler or implement a specialized handling.

func ChainMiddleware

func ChainMiddleware(middleware ...Middleware) Middleware

ChainMiddleware allows chaining multiple middlewares to one middleware.

type NSVisualEffectMaterial

type NSVisualEffectMaterial int

NSVisualEffectMaterial represents the NSVisualEffectMaterial enum for macOS

const (
	// NSVisualEffectMaterial values from macOS SDK
	NSVisualEffectMaterialAppearanceBased       NSVisualEffectMaterial = 0
	NSVisualEffectMaterialLight                 NSVisualEffectMaterial = 1
	NSVisualEffectMaterialDark                  NSVisualEffectMaterial = 2
	NSVisualEffectMaterialTitlebar              NSVisualEffectMaterial = 3
	NSVisualEffectMaterialSelection             NSVisualEffectMaterial = 4
	NSVisualEffectMaterialMenu                  NSVisualEffectMaterial = 5
	NSVisualEffectMaterialPopover               NSVisualEffectMaterial = 6
	NSVisualEffectMaterialSidebar               NSVisualEffectMaterial = 7
	NSVisualEffectMaterialHeaderView            NSVisualEffectMaterial = 10
	NSVisualEffectMaterialSheet                 NSVisualEffectMaterial = 11
	NSVisualEffectMaterialWindowBackground      NSVisualEffectMaterial = 12
	NSVisualEffectMaterialHUDWindow             NSVisualEffectMaterial = 13
	NSVisualEffectMaterialFullScreenUI          NSVisualEffectMaterial = 15
	NSVisualEffectMaterialToolTip               NSVisualEffectMaterial = 17
	NSVisualEffectMaterialContentBackground     NSVisualEffectMaterial = 18
	NSVisualEffectMaterialUnderWindowBackground NSVisualEffectMaterial = 21
	NSVisualEffectMaterialUnderPageBackground   NSVisualEffectMaterial = 22
	NSVisualEffectMaterialAuto                  NSVisualEffectMaterial = -1 // Use auto-selection based on Style
)

type NativeTabIcon

type NativeTabIcon string

NativeTabIcon is a string-based enum for SF Symbols. It allows using predefined constants for common symbols while still accepting any valid SF Symbols name as a plain string.

Example:

NativeTabsItems: []NativeTabItem{
  { Title: "Home", SystemImage: NativeTabIconHouse },
  { Title: "Settings", SystemImage: "gearshape" }, // arbitrary string still allowed
}
const (
	// Common icons
	NativeTabIconNone    NativeTabIcon = ""
	NativeTabIconHouse   NativeTabIcon = "house"
	NativeTabIconGear    NativeTabIcon = "gear"
	NativeTabIconStar    NativeTabIcon = "star"
	NativeTabIconPerson  NativeTabIcon = "person"
	NativeTabIconBell    NativeTabIcon = "bell"
	NativeTabIconMagnify NativeTabIcon = "magnifyingglass"
	NativeTabIconList    NativeTabIcon = "list.bullet"
	NativeTabIconFolder  NativeTabIcon = "folder"
)

type NativeTabItem

type NativeTabItem struct {
	Title       string        `json:"Title"`
	SystemImage NativeTabIcon `json:"SystemImage"`
}

NativeTabItem describes a single item in the iOS native UITabBar. SystemImage is the SF Symbols name to use for the icon (iOS 13+). If empty or unavailable on the current OS, no icon is shown.

type OffsetReference

type OffsetReference int
const (
	BEGIN OffsetReference = iota // TOP or LEFT
	END                          // BOTTOM or RIGHT
)

type OpenFileDialogOptions

type OpenFileDialogOptions struct {
	CanChooseDirectories            bool
	CanChooseFiles                  bool
	CanCreateDirectories            bool
	ShowHiddenFiles                 bool
	ResolvesAliases                 bool
	AllowsMultipleSelection         bool
	HideExtension                   bool
	CanSelectHiddenExtension        bool
	TreatsFilePackagesAsDirectories bool
	AllowsOtherFileTypes            bool
	Filters                         []FileFilter
	Window                          Window

	Title      string
	Message    string
	ButtonText string
	Directory  string
}

type OpenFileDialogStruct

type OpenFileDialogStruct struct {
	// contains filtered or unexported fields
}

func (*OpenFileDialogStruct) AddFilter

func (d *OpenFileDialogStruct) AddFilter(displayName, pattern string) *OpenFileDialogStruct

AddFilter adds a filter to the dialog. The filter is a display name and a semicolon separated list of extensions. EG: AddFilter("Image Files", "*.jpg;*.png")

func (*OpenFileDialogStruct) AllowsOtherFileTypes

func (d *OpenFileDialogStruct) AllowsOtherFileTypes(allowsOtherFileTypes bool) *OpenFileDialogStruct

func (*OpenFileDialogStruct) AttachToWindow

func (d *OpenFileDialogStruct) AttachToWindow(window Window) *OpenFileDialogStruct

func (*OpenFileDialogStruct) CanChooseDirectories

func (d *OpenFileDialogStruct) CanChooseDirectories(canChooseDirectories bool) *OpenFileDialogStruct

func (*OpenFileDialogStruct) CanChooseFiles

func (d *OpenFileDialogStruct) CanChooseFiles(canChooseFiles bool) *OpenFileDialogStruct

func (*OpenFileDialogStruct) CanCreateDirectories

func (d *OpenFileDialogStruct) CanCreateDirectories(canCreateDirectories bool) *OpenFileDialogStruct

func (*OpenFileDialogStruct) CanSelectHiddenExtension

func (d *OpenFileDialogStruct) CanSelectHiddenExtension(canSelectHiddenExtension bool) *OpenFileDialogStruct

func (*OpenFileDialogStruct) HideExtension

func (d *OpenFileDialogStruct) HideExtension(hideExtension bool) *OpenFileDialogStruct

func (*OpenFileDialogStruct) PromptForMultipleSelection

func (d *OpenFileDialogStruct) PromptForMultipleSelection() ([]string, error)

func (*OpenFileDialogStruct) PromptForSingleSelection

func (d *OpenFileDialogStruct) PromptForSingleSelection() (string, error)

func (*OpenFileDialogStruct) ResolvesAliases

func (d *OpenFileDialogStruct) ResolvesAliases(resolvesAliases bool) *OpenFileDialogStruct

func (*OpenFileDialogStruct) SetButtonText

func (d *OpenFileDialogStruct) SetButtonText(text string) *OpenFileDialogStruct

func (*OpenFileDialogStruct) SetDirectory

func (d *OpenFileDialogStruct) SetDirectory(directory string) *OpenFileDialogStruct

func (*OpenFileDialogStruct) SetMessage

func (d *OpenFileDialogStruct) SetMessage(message string) *OpenFileDialogStruct

func (*OpenFileDialogStruct) SetOptions

func (d *OpenFileDialogStruct) SetOptions(options *OpenFileDialogOptions)

func (*OpenFileDialogStruct) SetTitle

func (d *OpenFileDialogStruct) SetTitle(title string) *OpenFileDialogStruct

func (*OpenFileDialogStruct) ShowHiddenFiles

func (d *OpenFileDialogStruct) ShowHiddenFiles(showHiddenFiles bool) *OpenFileDialogStruct

func (*OpenFileDialogStruct) TreatsFilePackagesAsDirectories

func (d *OpenFileDialogStruct) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *OpenFileDialogStruct

type Options

type Options struct {
	// Name is the name of the application (used in the default about box)
	Name string

	// Description is the description of the application (used in the default about box)
	Description string

	// Icon is the icon of the application (used in the default about box)
	Icon []byte

	// Mac is the Mac specific configuration for Mac builds
	Mac MacOptions

	// Windows is the Windows specific configuration for Windows builds
	Windows WindowsOptions

	// Linux is the Linux specific configuration for Linux builds
	Linux LinuxOptions

	// IOS is the iOS specific configuration for iOS builds
	IOS IOSOptions

	// Android is the Android specific configuration for Android builds
	Android AndroidOptions

	// Services allows you to bind Go methods to the frontend.
	Services []Service

	// MarshalError will be called if non-nil
	// to marshal to JSON the error values returned by service methods.
	//
	// MarshalError is not allowed to fail,
	// but it may return a nil slice to fall back
	// to the default error handling mechanism.
	//
	// If the returned slice is not nil, it must contain valid JSON.
	MarshalError func(error) []byte

	// BindAliases allows you to specify alias IDs for your bound methods.
	// Example: `BindAliases: map[uint32]uint32{1: 1411160069}` states that alias ID 1 maps to the Go method with ID 1411160069.
	BindAliases map[uint32]uint32

	// Logger is a slog.Logger instance used for logging Wails system messages (not application messages).
	// If not defined, a default logger is used.
	Logger *slog.Logger

	// LogLevel defines the log level of the Wails system logger.
	LogLevel slog.Level

	// Assets are the application assets to be used.
	Assets AssetOptions

	// Flags are key value pairs that are available to the frontend.
	// This is also used by Wails to provide information to the frontend.
	Flags map[string]any

	// PanicHandler is called when a panic occurs
	PanicHandler func(*PanicDetails)

	// DisableDefaultSignalHandler disables the default signal handler
	DisableDefaultSignalHandler bool

	// KeyBindings is a map of key bindings to functions
	KeyBindings map[string]func(window Window)

	// OnShutdown is called when the application is about to terminate.
	// This is useful for cleanup tasks.
	// The shutdown process blocks until this function returns.
	OnShutdown func()

	// PostShutdown is called after the application
	// has finished shutting down, just before process termination.
	// This is useful for testing and logging purposes
	// on platforms where the Run() method does not return.
	// When PostShutdown is called, the application instance is not usable anymore.
	// The shutdown process blocks until this function returns.
	PostShutdown func()

	// ShouldQuit is a function that is called when the user tries to quit the application.
	// If the function returns true, the application will quit.
	// If the function returns false, the application will not quit.
	ShouldQuit func() bool

	// RawMessageHandler is called when the frontend sends a raw message.
	// This is useful for implementing custom frontend-to-backend communication.
	RawMessageHandler func(window Window, message string, originInfo *OriginInfo)

	// WarningHandler is called when a warning occurs
	WarningHandler func(string)

	// ErrorHandler is called when an error occurs
	ErrorHandler func(err error)

	// File extensions associated with the application
	// Example: [".txt", ".md"]
	// The '.' is required
	FileAssociations []string

	// SingleInstance options for single instance functionality
	SingleInstance *SingleInstanceOptions

	// Transport allows you to provide a custom IPC transport layer.
	// When set, Wails will use your transport instead of the default HTTP fetch-based transport.
	// This allows you to use WebSockets, custom protocols, or any other transport mechanism
	// while retaining all Wails generated bindings and event communication.
	//
	// The default transport uses HTTP fetch requests to /wails/runtime + events via js.Exec in webview.
	// If not specified, the default transport is used.
	//
	// Example use case: Implementing WebSocket-based or PostMessage IPC.
	Transport Transport
}

Options contains the options for the application

type OriginInfo

type OriginInfo struct {
	Origin      string
	TopOrigin   string
	IsMainFrame bool
}

type PX

type PX struct {
	W, H int
	Pix  []byte
}

type PanicDetails

type PanicDetails struct {
	StackTrace     string
	Error          error
	Time           time.Time
	FullStackTrace string
}

type Parameter

type Parameter struct {
	Name        string `json:"name,omitempty"`
	TypeName    string `json:"type"`
	ReflectType reflect.Type
}

Parameter defines a Go method parameter

func (*Parameter) IsError

func (p *Parameter) IsError() bool

IsError returns true if the parameter type is an error

func (*Parameter) IsType

func (p *Parameter) IsType(typename string) bool

IsType returns true if the given

type PathType

type PathType int
const (
	// PathHome is the user's home directory.
	PathHome PathType = iota

	// PathDataHome defines the base directory relative to which user-specific
	// data files should be stored. This directory is defined by the
	// $XDG_DATA_HOME environment variable. If the variable is not set,
	// a default equal to $HOME/.local/share should be used.
	PathDataHome

	// PathConfigHome defines the base directory relative to which user-specific
	// configuration files should be written. This directory is defined by
	// the $XDG_CONFIG_HOME environment variable. If the variable is
	// not set, a default equal to $HOME/.config should be used.
	PathConfigHome

	// PathStateHome defines the base directory relative to which user-specific
	// state files should be stored. This directory is defined by the
	// $XDG_STATE_HOME environment variable. If the variable is not set,
	// a default equal to ~/.local/state should be used.
	PathStateHome

	// PathCacheHome defines the base directory relative to which user-specific
	// non-essential (cached) data should be written. This directory is
	// defined by the $XDG_CACHE_HOME environment variable. If the variable
	// is not set, a default equal to $HOME/.cache should be used.
	PathCacheHome

	// PathRuntimeDir defines the base directory relative to which user-specific
	// non-essential runtime files and other file objects (such as sockets,
	// named pipes, etc.) should be stored. This directory is defined by the
	// $XDG_RUNTIME_DIR environment variable. If the variable is not set,
	// applications should fall back to a replacement directory with similar
	// capabilities. Applications should use this directory for communication
	// and synchronization purposes and should not place larger files in it,
	// since it might reside in runtime memory and cannot necessarily be
	// swapped out to disk.
	PathRuntimeDir

	// PathDesktop defines the location of the user's desktop directory.
	PathDesktop

	// PathDownload defines a suitable location for user downloaded files.
	PathDownload

	// PathDocuments defines a suitable location for user document files.
	PathDocuments

	// PathMusic defines a suitable location for user audio files.
	PathMusic

	// PathPictures defines a suitable location for user image files.
	PathPictures

	// PathVideos defines a suitable location for user video files.
	PathVideos

	// PathTemplates defines a suitable location for user template files.
	PathTemplates

	// PathPublicShare defines a suitable location for user shared files.
	PathPublicShare
)

type PathTypes

type PathTypes int
const (
	// PathsDataDirs defines the preference-ordered set of base directories to
	// search for data files in addition to the DataHome base directory.
	// This set of directories is defined by the $XDG_DATA_DIRS environment
	// variable. If the variable is not set, the default directories
	// to be used are /usr/local/share and /usr/share, in that order. The
	// DataHome directory is considered more important than any of the
	// directories defined by DataDirs. Therefore, user data files should be
	// written relative to the DataHome directory, if possible.
	PathsDataDirs PathTypes = iota

	// PathsConfigDirs defines the preference-ordered set of base directories
	// search for configuration files in addition to the ConfigHome base
	// directory. This set of directories is defined by the $XDG_CONFIG_DIRS
	// environment variable. If the variable is not set, a default equal
	// to /etc/xdg should be used. The ConfigHome directory is considered
	// more important than any of the directories defined by ConfigDirs.
	// Therefore, user config files should be written relative to the
	// ConfigHome directory, if possible.
	PathsConfigDirs

	// PathsFontDirs defines the common locations where font files are stored.
	PathsFontDirs

	// PathsApplicationDirs defines the common locations of applications.
	PathsApplicationDirs
)

type Point

type Point struct {
	X int
	Y int
}

func DipToPhysicalPoint

func DipToPhysicalPoint(dipPoint Point) Point

func PhysicalToDipPoint

func PhysicalToDipPoint(physicalPoint Point) Point

type RGBA

type RGBA struct {
	Red, Green, Blue, Alpha uint8
}

func NewRGB

func NewRGB(red, green, blue uint8) RGBA

func NewRGBA

func NewRGBA(red, green, blue, alpha uint8) RGBA

type Rect

type Rect struct {
	X      int
	Y      int
	Width  int
	Height int
}

func DipToPhysicalRect

func DipToPhysicalRect(dipRect Rect) Rect

func PhysicalToDipRect

func PhysicalToDipRect(physicalRect Rect) Rect

func (Rect) Contains

func (r Rect) Contains(pt Point) bool

func (Rect) Corner

func (r Rect) Corner() Point

func (Rect) InsideCorner

func (r Rect) InsideCorner() Point

func (Rect) Intersect

func (r Rect) Intersect(otherRect Rect) Rect

Get intersection with another rect

func (Rect) IsEmpty

func (r Rect) IsEmpty() bool

func (Rect) Origin

func (r Rect) Origin() Point

func (Rect) Size

func (r Rect) Size() Size

type Role

type Role uint

Role is a type to identify menu roles

const (
	NoRole       Role = iota
	AppMenu      Role = iota
	EditMenu     Role = iota
	ViewMenu     Role = iota
	WindowMenu   Role = iota
	ServicesMenu Role = iota
	HelpMenu     Role = iota

	Hide               Role = iota
	HideOthers         Role = iota
	ShowAll            Role = iota
	BringAllToFront    Role = iota
	UnHide             Role = iota
	About              Role = iota
	Undo               Role = iota
	Redo               Role = iota
	Cut                Role = iota
	Copy               Role = iota
	Paste              Role = iota
	PasteAndMatchStyle Role = iota
	SelectAll          Role = iota
	Delete             Role = iota
	SpeechMenu         Role = iota
	Quit               Role = iota
	FileMenu           Role = iota
	CloseWindow        Role = iota
	Reload             Role = iota
	ForceReload        Role = iota
	OpenDevTools       Role = iota
	ResetZoom          Role = iota
	ZoomIn             Role = iota
	ZoomOut            Role = iota
	ToggleFullscreen   Role = iota

	Minimise   Role = iota
	Zoom       Role = iota
	FullScreen Role = iota

	NewFile        Role = iota
	Open           Role = iota
	Save           Role = iota
	SaveAs         Role = iota
	StartSpeaking  Role = iota
	StopSpeaking   Role = iota
	Revert         Role = iota
	Print          Role = iota
	PageLayout     Role = iota
	Find           Role = iota
	FindAndReplace Role = iota
	FindNext       Role = iota
	FindPrevious   Role = iota
	Front          Role = iota
	Help           Role = iota
)

These constants need to be kept in sync with `v2/internal/frontend/desktop/darwin/Role.h`

type RuntimeRequest

type RuntimeRequest struct {
	// Object identifies which Wails subsystem to call (Call=0, Clipboard=1, etc.)
	// See objectNames in runtime.ts
	Object int `json:"object"`

	// Method identifies which method within the object to call
	Method int `json:"method"`

	// Args contains the method arguments
	Args *Args `json:"args"`

	// WebviewWindowName identifies the source window by name (optional, sent via header x-wails-window-name)
	WebviewWindowName string `json:"webviewWindowName,omitempty"`

	// WebviewWindowID identifies the source window (optional, sent via header x-wails-window-id)
	WebviewWindowID uint32 `json:"webviewWindowId,omitempty"`

	// ClientID identifies the frontend client (sent via header x-wails-client-id)
	ClientID string `json:"clientId,omitempty"`
}

type SaveFileDialogOptions

type SaveFileDialogOptions struct {
	CanCreateDirectories            bool
	ShowHiddenFiles                 bool
	CanSelectHiddenExtension        bool
	AllowOtherFileTypes             bool
	HideExtension                   bool
	TreatsFilePackagesAsDirectories bool
	Title                           string
	Message                         string
	Directory                       string
	Filename                        string
	ButtonText                      string
	Filters                         []FileFilter
	Window                          Window
}

type SaveFileDialogStruct

type SaveFileDialogStruct struct {
	// contains filtered or unexported fields
}

func (*SaveFileDialogStruct) AddFilter

func (d *SaveFileDialogStruct) AddFilter(displayName, pattern string) *SaveFileDialogStruct

AddFilter adds a filter to the dialog. The filter is a display name and a semicolon separated list of extensions. EG: AddFilter("Image Files", "*.jpg;*.png")

func (*SaveFileDialogStruct) AllowsOtherFileTypes

func (d *SaveFileDialogStruct) AllowsOtherFileTypes(allowOtherFileTypes bool) *SaveFileDialogStruct

func (*SaveFileDialogStruct) AttachToWindow

func (d *SaveFileDialogStruct) AttachToWindow(window Window) *SaveFileDialogStruct

func (*SaveFileDialogStruct) CanCreateDirectories

func (d *SaveFileDialogStruct) CanCreateDirectories(canCreateDirectories bool) *SaveFileDialogStruct

func (*SaveFileDialogStruct) CanSelectHiddenExtension

func (d *SaveFileDialogStruct) CanSelectHiddenExtension(canSelectHiddenExtension bool) *SaveFileDialogStruct

func (*SaveFileDialogStruct) HideExtension

func (d *SaveFileDialogStruct) HideExtension(hideExtension bool) *SaveFileDialogStruct

func (*SaveFileDialogStruct) PromptForSingleSelection

func (d *SaveFileDialogStruct) PromptForSingleSelection() (string, error)

func (*SaveFileDialogStruct) SetButtonText

func (d *SaveFileDialogStruct) SetButtonText(text string) *SaveFileDialogStruct

func (*SaveFileDialogStruct) SetDirectory

func (d *SaveFileDialogStruct) SetDirectory(directory string) *SaveFileDialogStruct

func (*SaveFileDialogStruct) SetFilename

func (d *SaveFileDialogStruct) SetFilename(filename string) *SaveFileDialogStruct

func (*SaveFileDialogStruct) SetMessage

func (d *SaveFileDialogStruct) SetMessage(message string) *SaveFileDialogStruct

func (*SaveFileDialogStruct) SetOptions

func (d *SaveFileDialogStruct) SetOptions(options *SaveFileDialogOptions)

func (*SaveFileDialogStruct) ShowHiddenFiles

func (d *SaveFileDialogStruct) ShowHiddenFiles(showHiddenFiles bool) *SaveFileDialogStruct

func (*SaveFileDialogStruct) TreatsFilePackagesAsDirectories

func (d *SaveFileDialogStruct) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *SaveFileDialogStruct

type Screen

type Screen struct {
	ID               string  // A unique identifier for the display
	Name             string  // The name of the display
	ScaleFactor      float32 // The scale factor of the display (DPI/96)
	X                int     // The x-coordinate of the top-left corner of the rectangle
	Y                int     // The y-coordinate of the top-left corner of the rectangle
	Size             Size    // The size of the display
	Bounds           Rect    // The bounds of the display
	PhysicalBounds   Rect    // The physical bounds of the display (before scaling)
	WorkArea         Rect    // The work area of the display
	PhysicalWorkArea Rect    // The physical work area of the display (before scaling)
	IsPrimary        bool    // Whether this is the primary display
	Rotation         float32 // The rotation of the display
}

func ScreenNearestDipPoint

func ScreenNearestDipPoint(dipPoint Point) *Screen

func ScreenNearestDipRect

func ScreenNearestDipRect(dipRect Rect) *Screen

func ScreenNearestPhysicalPoint

func ScreenNearestPhysicalPoint(physicalPoint Point) *Screen

func ScreenNearestPhysicalRect

func ScreenNearestPhysicalRect(physicalRect Rect) *Screen

func (Screen) Origin

func (s Screen) Origin() Point

type ScreenManager

type ScreenManager struct {
	// contains filtered or unexported fields
}

func (*ScreenManager) DipToPhysicalPoint

func (m *ScreenManager) DipToPhysicalPoint(dipPoint Point) Point

func (*ScreenManager) DipToPhysicalRect

func (m *ScreenManager) DipToPhysicalRect(dipRect Rect) Rect

func (*ScreenManager) GetAll

func (m *ScreenManager) GetAll() []*Screen

func (*ScreenManager) GetPrimary

func (m *ScreenManager) GetPrimary() *Screen

func (*ScreenManager) LayoutScreens

func (m *ScreenManager) LayoutScreens(screens []*Screen) error

Layout screens in the virtual space with DIP calculations and cache the screens for future coordinate transformation between the physical and logical (DIP) space

func (*ScreenManager) PhysicalToDipPoint

func (m *ScreenManager) PhysicalToDipPoint(physicalPoint Point) Point

func (*ScreenManager) PhysicalToDipRect

func (m *ScreenManager) PhysicalToDipRect(physicalRect Rect) Rect

func (*ScreenManager) ScreenNearestDipPoint

func (m *ScreenManager) ScreenNearestDipPoint(dipPoint Point) *Screen

func (*ScreenManager) ScreenNearestDipRect

func (m *ScreenManager) ScreenNearestDipRect(dipRect Rect) *Screen

func (*ScreenManager) ScreenNearestPhysicalPoint

func (m *ScreenManager) ScreenNearestPhysicalPoint(physicalPoint Point) *Screen

func (*ScreenManager) ScreenNearestPhysicalRect

func (m *ScreenManager) ScreenNearestPhysicalRect(physicalRect Rect) *Screen

type ScreenPlacement

type ScreenPlacement struct {
	// contains filtered or unexported fields
}

ScreenPlacement specifies where the screen (S) is placed relative to parent (P) screen. In the following example, (S) is RIGHT aligned to (P) with a positive offset and a BEGIN (top) offset reference.

. +------------+ + . | | | offset . | P | v . | +--------+ . | | | . +------------+ S | . | | . +--------+

type SecondInstanceData

type SecondInstanceData struct {
	Args           []string          `json:"args"`
	WorkingDir     string            `json:"workingDir"`
	AdditionalData map[string]string `json:"additionalData,omitempty"`
}

SecondInstanceData contains information about the second instance launch

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service wraps a bound type instance. The zero value of Service is invalid. Valid values may only be obtained by calling NewService.

func NewService

func NewService[T any](instance *T) Service

NewService returns a Service value wrapping the given pointer. If T is not a concrete named type, the returned value is invalid.

func NewServiceWithOptions

func NewServiceWithOptions[T any](instance *T, options ServiceOptions) Service

NewServiceWithOptions returns a Service value wrapping the given pointer and specifying the given service options. If T is not a concrete named type, the returned value is invalid.

func (Service) Instance

func (s Service) Instance() any

Instance returns the service instance provided to NewService.

type ServiceName

type ServiceName interface {
	ServiceName() string
}

ServiceName returns the name of the service

This is an *optional* method that may be implemented by service instances. It is used for logging and debugging purposes.

If a non-empty name is provided with ServiceOptions, it takes precedence over the one returned by the ServiceName method.

type ServiceOptions

type ServiceOptions struct {
	// Name can be set to override the name of the service
	// for logging and debugging purposes.
	//
	// If empty, it will default
	// either to the value obtained through the [ServiceName] interface,
	// or to the type name.
	Name string

	// If the service instance implements [http.Handler],
	// it will be mounted on the internal asset server
	// at the prefix specified by Route.
	Route string

	// MarshalError will be called if non-nil
	// to marshal to JSON the error values returned by this service's methods.
	//
	// MarshalError is not allowed to fail,
	// but it may return a nil slice to fall back
	// to the globally configured error handler.
	//
	// If the returned slice is not nil, it must contain valid JSON.
	MarshalError func(error) []byte
}

ServiceOptions provides optional parameters for calls to NewService.

type ServiceShutdown

type ServiceShutdown interface {
	ServiceShutdown() error
}

ServiceShutdown is an *optional* method that may be implemented by service instances.

This method will be called during application shutdown. It can be used for cleaning up resources. If a service has received a startup notification, then it is guaranteed to receive a shutdown notification too, except in case of unhandled panics during shutdown.

Services receive shutdown notifications in reverse registration order, after all user-provided shutdown hooks have run (see App.OnShutdown).

If the return value is non-nil, it is passed to the application's configured error handler at [Options.ErrorHandler], wrapped with fmt.Errorf in a user-friendly message comprising the service name. The default behaviour is to log the error along with the service name. The original error can be retrieved either by calling the Unwrap method or through the errors.As API.

type ServiceStartup

type ServiceStartup interface {
	ServiceStartup(ctx context.Context, options ServiceOptions) error
}

ServiceStartup is an *optional* method that may be implemented by service instances.

This method will be called during application startup and will receive a copy of the options specified at creation time. It can be used for initialising resources.

The context will be valid as long as the application is running, and will be cancelled right before shutdown.

Services are guaranteed to receive the startup notification in the exact order in which they were either listed in [Options.Services] or registered with App.RegisterService, with those from [Options.Services] coming first.

If the return value is non-nil, the startup process aborts and App.Run returns the error wrapped with fmt.Errorf in a user-friendly message comprising the service name. The original error can be retrieved either by calling the Unwrap method or through the errors.As API.

When that happens, service instances that have been already initialised receive a shutdown notification.

type SingleInstanceOptions

type SingleInstanceOptions struct {
	// UniqueID is used to identify the application instance
	// This should be unique per application, e.g. "com.myapp.myapplication"
	UniqueID string

	// OnSecondInstanceLaunch is called when a second instance of the application is launched
	// The callback receives data about the second instance launch
	OnSecondInstanceLaunch func(data SecondInstanceData)

	// AdditionalData allows passing custom data from second instance to first
	AdditionalData map[string]string

	// ExitCode is the exit code to use when the second instance exits
	ExitCode int

	// EncryptionKey is a 32-byte key used for encrypting instance communication
	// If not provided (zero array), data will be sent unencrypted
	EncryptionKey [32]byte
}

SingleInstanceOptions defines options for single instance functionality

type Size

type Size struct {
	Width  int
	Height int
}

type SystemTray

type SystemTray struct {
	// contains filtered or unexported fields
}

func (*SystemTray) AttachWindow

func (s *SystemTray) AttachWindow(window Window) *SystemTray

AttachWindow attaches a window to the system tray. The window will be shown when the system tray icon is clicked. The window will be hidden when the system tray icon is clicked again, or when the window loses focus.

func (*SystemTray) Destroy

func (s *SystemTray) Destroy()

func (*SystemTray) Hide

func (s *SystemTray) Hide()

func (*SystemTray) Label

func (s *SystemTray) Label() string

func (*SystemTray) OnClick

func (s *SystemTray) OnClick(handler func()) *SystemTray

func (*SystemTray) OnDoubleClick

func (s *SystemTray) OnDoubleClick(handler func()) *SystemTray

func (*SystemTray) OnMouseEnter

func (s *SystemTray) OnMouseEnter(handler func()) *SystemTray

func (*SystemTray) OnMouseLeave

func (s *SystemTray) OnMouseLeave(handler func()) *SystemTray

func (*SystemTray) OnRightClick

func (s *SystemTray) OnRightClick(handler func()) *SystemTray

func (*SystemTray) OnRightDoubleClick

func (s *SystemTray) OnRightDoubleClick(handler func()) *SystemTray

func (*SystemTray) OpenMenu

func (s *SystemTray) OpenMenu()

func (*SystemTray) PositionWindow

func (s *SystemTray) PositionWindow(window Window, offset int) error

func (*SystemTray) Run

func (s *SystemTray) Run()

func (*SystemTray) SetDarkModeIcon

func (s *SystemTray) SetDarkModeIcon(icon []byte) *SystemTray

func (*SystemTray) SetIcon

func (s *SystemTray) SetIcon(icon []byte) *SystemTray

func (*SystemTray) SetIconPosition

func (s *SystemTray) SetIconPosition(iconPosition IconPosition) *SystemTray

func (*SystemTray) SetLabel

func (s *SystemTray) SetLabel(label string)

func (*SystemTray) SetMenu

func (s *SystemTray) SetMenu(menu *Menu) *SystemTray

func (*SystemTray) SetTemplateIcon

func (s *SystemTray) SetTemplateIcon(icon []byte) *SystemTray

func (*SystemTray) SetTooltip

func (s *SystemTray) SetTooltip(tooltip string)

func (*SystemTray) Show

func (s *SystemTray) Show()

func (*SystemTray) WindowDebounce

func (s *SystemTray) WindowDebounce(debounce time.Duration) *SystemTray

WindowDebounce is used by Windows to indicate how long to wait before responding to a mouse up event on the notification icon. This prevents the window from being hidden and then immediately shown when the user clicks on the system tray icon. See https://stackoverflow.com/questions/4585283/alternate-showing-hiding-window-when-notify-icon-is-clicked

func (*SystemTray) WindowOffset

func (s *SystemTray) WindowOffset(offset int) *SystemTray

WindowOffset sets the gap in pixels between the system tray and the window

type SystemTrayManager

type SystemTrayManager struct {
	// contains filtered or unexported fields
}

SystemTrayManager manages system tray-related operations

func (*SystemTrayManager) New

func (stm *SystemTrayManager) New() *SystemTray

New creates a new system tray

type TextTheme

type TextTheme struct {
	// Text is the colour of the text
	Text *uint32

	// Background is the background colour of the text
	Background *uint32
}

type Theme

type Theme int
const (
	// SystemDefault will use whatever the system theme is. The application will follow system theme changes.
	SystemDefault Theme = 0
	// Dark Mode
	Dark Theme = 1
	// Light Mode
	Light Theme = 2
)

type ThemeSettings

type ThemeSettings struct {
	// Dark mode active window
	DarkModeActive *WindowTheme

	// Dark mode inactive window
	DarkModeInactive *WindowTheme

	// Light mode active window
	LightModeActive *WindowTheme

	// Light mode inactive window
	LightModeInactive *WindowTheme

	// Dark mode MenuBar
	DarkModeMenuBar *MenuBarTheme

	// Light mode MenuBar
	LightModeMenuBar *MenuBarTheme
}

ThemeSettings defines custom colours to use in dark or light mode. They may be set using the hex values: 0x00BBGGRR

type Transport

type Transport interface {
	// Start initializes and starts the transport layer.
	// The provided handler should be called to process Wails runtime requests.
	// The context is the application context and will be cancelled on shutdown.
	Start(ctx context.Context, messageProcessor *MessageProcessor) error

	JSClient() []byte

	// Stop gracefully shuts down the transport.
	Stop() error
}

Transport defines the interface for custom IPC transport implementations. Developers can provide their own transport (e.g., WebSocket, custom protocol) while retaining all Wails generated bindings and event communication.

The transport is responsible for:

  • Receiving runtime call requests from the frontend
  • Processing them through Wails' MessageProcessor
  • Sending responses back to the frontend

Example use case: Implementing WebSocket-based transport instead of HTTP fetch.

type TransportHTTPHandler

type TransportHTTPHandler interface {
	Handler() func(next http.Handler) http.Handler
}

TransportHTTPHandler is an optional interface that transports can implement to provide HTTP middleware for the Wails asset server in webview scenarios.

When a transport implements this interface, Wails will use Handler() in asset server middlewares that may provide handling for request done from webview to wails:// URLs.

This is used by the default HTTP transport to handle IPC endpoints.

type Void

type Void interface {
	// contains filtered or unexported methods
}

Void will be translated by the binding generator to the TypeScript type 'void'. It can be used as an event data type to register events that must not have any associated data.

type WailsEventListener

type WailsEventListener interface {
	DispatchWailsEvent(event *CustomEvent)
}

WailsEventListener is an interface that can be implemented to listen for Wails events It is used by the RegisterListener method of the Application.

type WebviewGpuPolicy

type WebviewGpuPolicy int

WebviewGpuPolicy values used for determining the webview's hardware acceleration policy.

const (
	// WebviewGpuPolicyAlways Hardware acceleration is always enabled.
	WebviewGpuPolicyAlways WebviewGpuPolicy = iota
	// WebviewGpuPolicyOnDemand Hardware acceleration is enabled/disabled as request by web contents.
	WebviewGpuPolicyOnDemand
	// WebviewGpuPolicyNever Hardware acceleration is always disabled.
	WebviewGpuPolicyNever
)

type WebviewWindow

type WebviewWindow struct {
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow(options WebviewWindowOptions) *WebviewWindow

NewWindow creates a new window with the given options

func (*WebviewWindow) Bounds

func (w *WebviewWindow) Bounds() Rect

Bounds returns the DIP bounds of the window

func (*WebviewWindow) Center

func (w *WebviewWindow) Center()

Center centers the window on the screen

func (*WebviewWindow) Close

func (w *WebviewWindow) Close()

Close closes the window

func (*WebviewWindow) DisableSizeConstraints

func (w *WebviewWindow) DisableSizeConstraints()

func (*WebviewWindow) DispatchWailsEvent

func (w *WebviewWindow) DispatchWailsEvent(event *CustomEvent)

func (*WebviewWindow) EmitEvent

func (w *WebviewWindow) EmitEvent(name string, data ...any) bool

EmitEvent emits a custom event with the specified name and associated data. It returns a boolean indicating whether the event was cancelled by a hook. The [CustomEvent.Sender] field will be set to the window name.

If the given event name is registered, EmitEvent validates the data parameter against the expected data type. In case of a mismatch, EmitEvent reports an error to the registered error handler for the application and cancels the event.

func (*WebviewWindow) EnableSizeConstraints

func (w *WebviewWindow) EnableSizeConstraints()

func (*WebviewWindow) Error

func (w *WebviewWindow) Error(message string, args ...any)

func (*WebviewWindow) ExecJS

func (w *WebviewWindow) ExecJS(js string)

ExecJS executes the given javascript in the context of the window.

func (*WebviewWindow) Flash

func (w *WebviewWindow) Flash(enabled bool)

Flash flashes the window's taskbar button/icon. Useful to indicate that attention is required. Windows only.

func (*WebviewWindow) Focus

func (w *WebviewWindow) Focus()

func (*WebviewWindow) ForceReload

func (w *WebviewWindow) ForceReload()

ForceReload forces the window to reload the page assets

func (*WebviewWindow) Fullscreen

func (w *WebviewWindow) Fullscreen() Window

Fullscreen sets the window to fullscreen mode. Min/Max size constraints are disabled.

func (*WebviewWindow) GetBorderSizes

func (w *WebviewWindow) GetBorderSizes() *LRTB

func (*WebviewWindow) GetScreen

func (w *WebviewWindow) GetScreen() (*Screen, error)

GetScreen returns the screen that the window is on

func (*WebviewWindow) GetZoom

func (w *WebviewWindow) GetZoom() float64

GetZoom returns the current zoom level of the window.

func (*WebviewWindow) HandleDragEnter

func (w *WebviewWindow) HandleDragEnter()

HandleDragEnter is called when drag enters the window (Linux only, since GTK intercepts drag events)

func (*WebviewWindow) HandleDragLeave

func (w *WebviewWindow) HandleDragLeave()

HandleDragLeave is called when drag leaves the window

func (*WebviewWindow) HandleDragOver

func (w *WebviewWindow) HandleDragOver(x int, y int)

HandleDragOver is called during drag-motion to update hover state in JS This is called from the GTK main thread, so we can call execJS directly

func (*WebviewWindow) HandleKeyEvent

func (w *WebviewWindow) HandleKeyEvent(acceleratorString string)

func (*WebviewWindow) HandleMessage

func (w *WebviewWindow) HandleMessage(message string)

func (*WebviewWindow) HandleWindowEvent

func (w *WebviewWindow) HandleWindowEvent(id uint)

func (*WebviewWindow) Height

func (w *WebviewWindow) Height() int

Height returns the height of the window

func (*WebviewWindow) Hide

func (w *WebviewWindow) Hide() Window

Hide hides the window.

func (*WebviewWindow) HideMenuBar

func (w *WebviewWindow) HideMenuBar()

HideMenuBar hides the menu bar for the window.

func (*WebviewWindow) ID

func (w *WebviewWindow) ID() uint

func (*WebviewWindow) Info

func (w *WebviewWindow) Info(message string, args ...any)

func (*WebviewWindow) InitiateFrontendDropProcessing

func (w *WebviewWindow) InitiateFrontendDropProcessing(filenames []string, x int, y int)

func (*WebviewWindow) IsFocused

func (w *WebviewWindow) IsFocused() bool

IsFocused returns true if the window is currently focused

func (*WebviewWindow) IsFullscreen

func (w *WebviewWindow) IsFullscreen() bool

IsFullscreen returns true if the window is fullscreen

func (*WebviewWindow) IsIgnoreMouseEvents

func (w *WebviewWindow) IsIgnoreMouseEvents() bool

func (*WebviewWindow) IsMaximised

func (w *WebviewWindow) IsMaximised() bool

IsMaximised returns true if the window is maximised

func (*WebviewWindow) IsMinimised

func (w *WebviewWindow) IsMinimised() bool

IsMinimised returns true if the window is minimised

func (*WebviewWindow) IsVisible

func (w *WebviewWindow) IsVisible() bool

IsVisible returns true if the window is visible

func (*WebviewWindow) Maximise

func (w *WebviewWindow) Maximise() Window

Maximise maximises the window. Min/Max size constraints are disabled.

func (*WebviewWindow) Minimise

func (w *WebviewWindow) Minimise() Window

Minimise minimises the window.

func (*WebviewWindow) Name

func (w *WebviewWindow) Name() string

Name returns the name of the window

func (*WebviewWindow) NativeWindow

func (w *WebviewWindow) NativeWindow() unsafe.Pointer

NativeWindow returns the platform-specific native window handle

func (*WebviewWindow) OnWindowEvent

func (w *WebviewWindow) OnWindowEvent(
	eventType events.WindowEventType,
	callback func(event *WindowEvent),
) func()

OnWindowEvent registers a callback for the given window event

func (*WebviewWindow) OpenContextMenu

func (w *WebviewWindow) OpenContextMenu(data *ContextMenuData)

func (*WebviewWindow) OpenDevTools

func (w *WebviewWindow) OpenDevTools()

func (*WebviewWindow) PhysicalBounds

func (w *WebviewWindow) PhysicalBounds() Rect

PhysicalBounds returns the physical bounds of the window

func (*WebviewWindow) Position

func (w *WebviewWindow) Position() (int, int)

Position returns the absolute position of the window

func (*WebviewWindow) Print

func (w *WebviewWindow) Print() error

func (*WebviewWindow) RegisterHook

func (w *WebviewWindow) RegisterHook(
	eventType events.WindowEventType,
	callback func(event *WindowEvent),
) func()

RegisterHook registers a hook for the given window event

func (*WebviewWindow) RelativePosition

func (w *WebviewWindow) RelativePosition() (int, int)

RelativePosition returns the position of the window relative to the screen WorkArea on which it is

func (*WebviewWindow) Reload

func (w *WebviewWindow) Reload()

Reload reloads the page assets

func (*WebviewWindow) Resizable

func (w *WebviewWindow) Resizable() bool

Resizable returns true if the window is resizable.

func (*WebviewWindow) Restore

func (w *WebviewWindow) Restore()

Restore restores the window to its previous state if it was previously minimised, maximised or fullscreen.

func (*WebviewWindow) Run

func (w *WebviewWindow) Run()

func (*WebviewWindow) SetAlwaysOnTop

func (w *WebviewWindow) SetAlwaysOnTop(b bool) Window

SetAlwaysOnTop sets the window to be always on top.

func (*WebviewWindow) SetBackgroundColour

func (w *WebviewWindow) SetBackgroundColour(colour RGBA) Window

SetBackgroundColour sets the background colour of the window

func (*WebviewWindow) SetBounds

func (w *WebviewWindow) SetBounds(bounds Rect)

SetBounds sets the DIP bounds of the window

func (*WebviewWindow) SetCloseButtonState

func (w *WebviewWindow) SetCloseButtonState(state ButtonState) Window

func (*WebviewWindow) SetContentProtection

func (w *WebviewWindow) SetContentProtection(b bool) Window

func (*WebviewWindow) SetEnabled

func (w *WebviewWindow) SetEnabled(enabled bool)

func (*WebviewWindow) SetFrameless

func (w *WebviewWindow) SetFrameless(frameless bool) Window

SetFrameless removes the window frame and title bar

func (*WebviewWindow) SetHTML

func (w *WebviewWindow) SetHTML(html string) Window

SetHTML sets the HTML of the window to the given html string.

func (*WebviewWindow) SetIgnoreMouseEvents

func (w *WebviewWindow) SetIgnoreMouseEvents(ignore bool) Window

func (*WebviewWindow) SetMaxSize

func (w *WebviewWindow) SetMaxSize(maxWidth, maxHeight int) Window

SetMaxSize sets the maximum size of the window.

func (*WebviewWindow) SetMaximiseButtonState

func (w *WebviewWindow) SetMaximiseButtonState(state ButtonState) Window

func (*WebviewWindow) SetMenu

func (w *WebviewWindow) SetMenu(menu *Menu)

func (*WebviewWindow) SetMinSize

func (w *WebviewWindow) SetMinSize(minWidth, minHeight int) Window

SetMinSize sets the minimum size of the window.

func (*WebviewWindow) SetMinimiseButtonState

func (w *WebviewWindow) SetMinimiseButtonState(state ButtonState) Window

func (*WebviewWindow) SetPhysicalBounds

func (w *WebviewWindow) SetPhysicalBounds(physicalBounds Rect)

SetPhysicalBounds sets the physical bounds of the window

func (*WebviewWindow) SetPosition

func (w *WebviewWindow) SetPosition(x int, y int)

SetPosition sets the absolute position of the window.

func (*WebviewWindow) SetRelativePosition

func (w *WebviewWindow) SetRelativePosition(x, y int) Window

SetRelativePosition sets the position of the window relative to the screen WorkArea on which it is.

func (*WebviewWindow) SetResizable

func (w *WebviewWindow) SetResizable(b bool) Window

SetResizable sets whether the window is resizable.

func (*WebviewWindow) SetSize

func (w *WebviewWindow) SetSize(width, height int) Window

SetSize sets the size of the window

func (*WebviewWindow) SetTitle

func (w *WebviewWindow) SetTitle(title string) Window

SetTitle sets the title of the window

func (*WebviewWindow) SetURL

func (w *WebviewWindow) SetURL(s string) Window

func (*WebviewWindow) SetZoom

func (w *WebviewWindow) SetZoom(magnification float64) Window

SetZoom sets the zoom level of the window.

func (*WebviewWindow) Show

func (w *WebviewWindow) Show() Window

Show shows the window.

func (*WebviewWindow) ShowMenuBar

func (w *WebviewWindow) ShowMenuBar()

ShowMenuBar shows the menu bar for the window.

func (*WebviewWindow) Size

func (w *WebviewWindow) Size() (int, int)

Size returns the size of the window

func (*WebviewWindow) SnapAssist

func (w *WebviewWindow) SnapAssist()

SnapAssist triggers the Windows Snap Assist feature by simulating Win+Z key combination. On Windows, this opens the snap layout options. On Linux and macOS, this is a no-op.

func (*WebviewWindow) ToggleFrameless

func (w *WebviewWindow) ToggleFrameless()

ToggleFrameless toggles the window between frameless and normal

func (*WebviewWindow) ToggleFullscreen

func (w *WebviewWindow) ToggleFullscreen()

ToggleFullscreen toggles the window between fullscreen and normal

func (*WebviewWindow) ToggleMaximise

func (w *WebviewWindow) ToggleMaximise()

ToggleMaximise toggles the window between maximised and normal

func (*WebviewWindow) ToggleMenuBar

func (w *WebviewWindow) ToggleMenuBar()

ToggleMenuBar toggles the menu bar for the window.

func (*WebviewWindow) UnFullscreen

func (w *WebviewWindow) UnFullscreen()

UnFullscreen un-fullscreens the window. Min/Max size constraints are re-enabled.

func (*WebviewWindow) UnMaximise

func (w *WebviewWindow) UnMaximise()

UnMaximise un-maximises the window. Min/Max size constraints are re-enabled.

func (*WebviewWindow) UnMinimise

func (w *WebviewWindow) UnMinimise()

UnMinimise un-minimises the window. Min/Max size constraints are re-enabled.

func (*WebviewWindow) Width

func (w *WebviewWindow) Width() int

Width returns the width of the window

func (*WebviewWindow) Zoom

func (w *WebviewWindow) Zoom()

func (*WebviewWindow) ZoomIn

func (w *WebviewWindow) ZoomIn()

ZoomIn increases the zoom level of the webview content

func (*WebviewWindow) ZoomOut

func (w *WebviewWindow) ZoomOut()

ZoomOut decreases the zoom level of the webview content

func (*WebviewWindow) ZoomReset

func (w *WebviewWindow) ZoomReset() Window

ZoomReset resets the zoom level of the webview content to 100%

type WebviewWindowOptions

type WebviewWindowOptions struct {
	// Name is a unique identifier that can be given to a window.
	Name string

	// Title is the title of the window.
	Title string

	// Width is the starting width of the window.
	Width int

	// Height is the starting height of the window.
	Height int

	// AlwaysOnTop will make the window float above other windows.
	AlwaysOnTop bool

	// URL is the URL to load in the window.
	URL string

	// DisableResize will disable the ability to resize the window.
	DisableResize bool

	// Frameless will remove the window frame.
	Frameless bool

	// MinWidth is the minimum width of the window.
	MinWidth int

	// MinHeight is the minimum height of the window.
	MinHeight int

	// MaxWidth is the maximum width of the window.
	MaxWidth int

	// MaxHeight is the maximum height of the window.
	MaxHeight int

	// StartState indicates the state of the window when it is first shown.
	// Default: WindowStateNormal
	StartState WindowState

	// BackgroundType is the type of background to use for the window.
	// Default: BackgroundTypeSolid
	BackgroundType BackgroundType

	// BackgroundColour is the colour to use for the window background.
	BackgroundColour RGBA

	// HTML is the HTML to load in the window.
	HTML string

	// JS is the JavaScript to load in the window.
	JS string

	// CSS is the CSS to load in the window.
	CSS string

	// Initial Position
	InitialPosition WindowStartPosition

	// X is the starting X position of the window.
	X int

	// Y is the starting Y position of the window.
	Y int

	// Hidden will hide the window when it is first created.
	Hidden bool

	// Zoom is the zoom level of the window.
	Zoom float64

	// ZoomControlEnabled will enable the zoom control.
	ZoomControlEnabled bool

	// EnableFileDrop enables drag and drop of files onto the window.
	// When enabled, files dragged from the OS onto elements with the
	// `data-file-drop-target` attribute will trigger a FilesDropped event.
	EnableFileDrop bool

	// OpenInspectorOnStartup will open the inspector when the window is first shown.
	OpenInspectorOnStartup bool

	// Mac options
	Mac MacWindow

	// Windows options
	Windows WindowsWindow

	// Linux options
	Linux LinuxWindow

	// Toolbar button states
	MinimiseButtonState ButtonState
	MaximiseButtonState ButtonState
	CloseButtonState    ButtonState

	// If true, the window's devtools will be available (default true in builds without the `production` build tag)
	DevToolsEnabled bool

	// If true, the window's default context menu will be disabled (default false)
	DefaultContextMenuDisabled bool

	// KeyBindings is a map of key bindings to functions
	KeyBindings map[string]func(window Window)

	// IgnoreMouseEvents will ignore mouse events in the window (Windows + Mac only)
	IgnoreMouseEvents bool

	// ContentProtectionEnabled specifies whether content protection is enabled, preventing screen capture and recording.
	// Effective on Windows and macOS only; no-op on Linux.
	// Best-effort protection with platform-specific caveats (see docs).
	ContentProtectionEnabled bool
}

type Window

type Window interface {
	Center()
	Close()
	DisableSizeConstraints()
	DispatchWailsEvent(event *CustomEvent)
	EmitEvent(name string, data ...any) bool
	EnableSizeConstraints()
	Error(message string, args ...any)
	ExecJS(js string)
	Focus()
	ForceReload()
	Fullscreen() Window
	GetBorderSizes() *LRTB
	GetScreen() (*Screen, error)
	GetZoom() float64

	InitiateFrontendDropProcessing(filenames []string, x int, y int)
	HandleMessage(message string)
	HandleWindowEvent(id uint)
	Height() int
	Hide() Window
	HideMenuBar()
	ID() uint
	Info(message string, args ...any)
	IsFocused() bool
	IsFullscreen() bool
	IsIgnoreMouseEvents() bool
	IsMaximised() bool
	IsMinimised() bool
	HandleKeyEvent(acceleratorString string)
	Maximise() Window
	Minimise() Window
	Name() string
	OnWindowEvent(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
	OpenContextMenu(data *ContextMenuData)
	Position() (int, int)
	RelativePosition() (int, int)
	Reload()
	Resizable() bool
	Restore()
	Run()
	SetPosition(x, y int)
	SetAlwaysOnTop(b bool) Window
	SetBackgroundColour(colour RGBA) Window
	SetFrameless(frameless bool) Window
	SetHTML(html string) Window
	SetMinimiseButtonState(state ButtonState) Window
	SetMaximiseButtonState(state ButtonState) Window
	SetCloseButtonState(state ButtonState) Window
	SetMaxSize(maxWidth, maxHeight int) Window
	SetMinSize(minWidth, minHeight int) Window
	SetRelativePosition(x, y int) Window
	SetResizable(b bool) Window
	SetIgnoreMouseEvents(ignore bool) Window
	SetSize(width, height int) Window
	SetTitle(title string) Window
	SetURL(s string) Window
	SetZoom(magnification float64) Window
	Show() Window
	ShowMenuBar()
	Size() (width int, height int)
	OpenDevTools()
	ToggleFullscreen()
	ToggleMaximise()
	ToggleMenuBar()
	ToggleFrameless()
	UnFullscreen()
	UnMaximise()
	UnMinimise()
	Width() int
	IsVisible() bool
	Bounds() Rect
	SetBounds(bounds Rect)
	Zoom()
	ZoomIn()
	ZoomOut()
	ZoomReset() Window
	SetMenu(menu *Menu)
	SnapAssist()
	SetContentProtection(protection bool) Window
	NativeWindow() unsafe.Pointer
	SetEnabled(enabled bool)
	Flash(enabled bool)
	Print() error
	RegisterHook(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
	// contains filtered or unexported methods
}

type WindowAttachConfig

type WindowAttachConfig struct {
	// Window is the window to attach to the system tray. If it's null, the request to attach will be ignored.
	Window Window

	// Offset indicates the gap in pixels between the system tray and the window
	Offset int

	// Debounce is used by Windows to indicate how long to wait before responding to a mouse
	// up event on the notification icon. See https://stackoverflow.com/questions/4585283/alternate-showing-hiding-window-when-notify-icon-is-clicked
	Debounce time.Duration
	// contains filtered or unexported fields
}

type WindowEvent

type WindowEvent struct {
	// contains filtered or unexported fields
}

func NewWindowEvent

func NewWindowEvent() *WindowEvent

func (*WindowEvent) Cancel

func (w *WindowEvent) Cancel()

func (*WindowEvent) Context

func (w *WindowEvent) Context() *WindowEventContext

func (*WindowEvent) IsCancelled

func (w *WindowEvent) IsCancelled() bool

type WindowEventContext

type WindowEventContext struct {
	// contains filtered or unexported fields
}

func (WindowEventContext) DropTargetDetails

func (c WindowEventContext) DropTargetDetails() *DropTargetDetails

DropTargetDetails retrieves information about the drop target element.

func (WindowEventContext) DroppedFiles

func (c WindowEventContext) DroppedFiles() []string

type WindowEventListener

type WindowEventListener struct {
	// contains filtered or unexported fields
}

type WindowManager

type WindowManager struct {
	// contains filtered or unexported fields
}

WindowManager manages all window-related operations

func (*WindowManager) Add

func (wm *WindowManager) Add(window Window)

Add adds a window to the manager

func (*WindowManager) Current

func (wm *WindowManager) Current() Window

Current returns the current active window (may be nil)

func (*WindowManager) Get

func (wm *WindowManager) Get(name string) (Window, bool)

Get is an alias for GetByName for consistency

func (*WindowManager) GetAll

func (wm *WindowManager) GetAll() []Window

GetAll returns all windows

func (*WindowManager) GetByID

func (wm *WindowManager) GetByID(id uint) (Window, bool)

GetByID returns a window by ID and whether it exists

func (*WindowManager) GetByName

func (wm *WindowManager) GetByName(name string) (Window, bool)

GetByName returns a window by name and whether it exists

func (*WindowManager) New

func (wm *WindowManager) New() *WebviewWindow

New creates a new webview window

func (*WindowManager) NewWithOptions

func (wm *WindowManager) NewWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow

NewWithOptions creates a new webview window with options

func (*WindowManager) OnCreate

func (wm *WindowManager) OnCreate(callback func(Window))

OnCreate registers a callback to be called when a window is created

func (*WindowManager) Remove

func (wm *WindowManager) Remove(windowID uint)

Remove removes a window from the manager by ID

func (*WindowManager) RemoveByName

func (wm *WindowManager) RemoveByName(name string) bool

RemoveByName removes a window from the manager by name

type WindowStartPosition

type WindowStartPosition int
const (
	WindowCentered WindowStartPosition = 0
	WindowXY       WindowStartPosition = 1
)

type WindowState

type WindowState int
const (
	WindowStateNormal WindowState = iota
	WindowStateMinimised
	WindowStateMaximised
	WindowStateFullscreen
)

type WindowTheme

type WindowTheme struct {
	// BorderColour is the colour of the window border
	BorderColour *uint32

	// TitleBarColour is the colour of the window title bar
	TitleBarColour *uint32

	// TitleTextColour is the colour of the window title text
	TitleTextColour *uint32
}

type WindowsOptions

type WindowsOptions struct {

	// Window class name
	// Default: WailsWebviewWindow
	WndClass string

	// WndProcInterceptor is a function that will be called for every message sent in the application.
	// Use this to hook into the main message loop. This is useful for handling custom window messages.
	// If `shouldReturn` is `true` then `returnCode` will be returned by the main message loop.
	// If `shouldReturn` is `false` then returnCode will be ignored and the message will be processed by the main message loop.
	WndProcInterceptor func(hwnd uintptr, msg uint32, wParam, lParam uintptr) (returnCode uintptr, shouldReturn bool)

	// DisableQuitOnLastWindowClosed disables the auto quit of the application if the last window has been closed.
	DisableQuitOnLastWindowClosed bool

	// Path where the WebView2 stores the user data. If empty %APPDATA%\[BinaryName.exe] will be used.
	// If the path is not valid, a messagebox will be displayed with the error and the app will exit with error code.
	WebviewUserDataPath string

	// Path to the directory with WebView2 executables. If empty WebView2 installed in the system will be used.
	WebviewBrowserPath string
}

WindowsOptions contains options for Windows applications.

type WindowsWindow

type WindowsWindow struct {
	// Select the type of translucent backdrop. Requires Windows 11 22621 or later.
	// Only used when window's `BackgroundType` is set to `BackgroundTypeTranslucent`.
	// Default: Auto
	BackdropType BackdropType

	// Disable the icon in the titlebar
	// Default: false
	DisableIcon bool

	// Theme (Dark / Light / SystemDefault)
	// Default: SystemDefault - The application will follow system theme changes.
	Theme Theme

	// Specify custom colours to use for dark/light mode
	// Default: nil
	CustomTheme ThemeSettings

	// Disable all window decorations in Frameless mode, which means no "Aero Shadow" and no "Rounded Corner" will be shown.
	// "Rounded Corners" are only available on Windows 11.
	// Default: false
	DisableFramelessWindowDecorations bool

	// WindowMask is used to set the window shape. Use a PNG with an alpha channel to create a custom shape.
	// Default: nil
	WindowMask []byte

	// WindowMaskDraggable is used to make the window draggable by clicking on the window mask.
	// Default: false
	WindowMaskDraggable bool

	// ResizeDebounceMS is the amount of time to debounce redraws of webview2
	// when resizing the window
	// Default: 0
	ResizeDebounceMS uint16

	// WindowDidMoveDebounceMS is the amount of time to debounce the WindowDidMove event
	// when moving the window
	// Default: 0
	WindowDidMoveDebounceMS uint16

	// Event mapping for the window. This allows you to define a translation from one event to another.
	// Default: nil
	EventMapping map[events.WindowEventType]events.WindowEventType

	// HiddenOnTaskbar hides the window from the taskbar
	// Default: false
	HiddenOnTaskbar bool

	// EnableSwipeGestures enables swipe gestures for the window
	// Default: false
	EnableSwipeGestures bool

	// Menu is the menu to use for the window.
	Menu *Menu

	// Permissions map for WebView2. If empty, default permissions will be granted.
	Permissions map[CoreWebView2PermissionKind]CoreWebView2PermissionState

	// ExStyle is the extended window style
	ExStyle int

	// GeneralAutofillEnabled enables general autofill
	GeneralAutofillEnabled bool

	// PasswordAutosaveEnabled enables autosaving passwords
	PasswordAutosaveEnabled bool

	// EnabledFeatures, DisabledFeatures and AdditionalLaunchArgs are used to enable or disable specific features in the WebView2 browser.
	// Available flags: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/webview-features-flags?tabs=dotnetcsharp#available-webview2-browser-flags
	// WARNING: Apps in production shouldn't use WebView2 browser flags,
	// because these flags might be removed or altered at any time,
	// and aren't necessarily supported long-term.
	// AdditionalLaunchArgs should always be preceded by "--"
	EnabledFeatures      []string
	DisabledFeatures     []string
	AdditionalLaunchArgs []string
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL