Documentation
¶
Index ¶
- Constants
- func BrowserOpenURL(ctx context.Context, url string)
- func CheckNotificationAuthorization(ctx context.Context) (bool, error)
- func CleanupNotifications(ctx context.Context)
- func ClipboardGetText(ctx context.Context) (string, error)
- func ClipboardSetText(ctx context.Context, text string) error
- func EventsEmit(ctx context.Context, eventName string, optionalData ...interface{})
- func EventsOff(ctx context.Context, eventName string, additionalEventNames ...string)
- func EventsOffAll(ctx context.Context)
- func EventsOn(ctx context.Context, eventName string, ...) func()
- func EventsOnMultiple(ctx context.Context, eventName string, ...) func()
- func EventsOnce(ctx context.Context, eventName string, ...) func()
- func Hide(ctx context.Context)
- func InitializeNotifications(ctx context.Context) error
- func IsNotificationAvailable(ctx context.Context) bool
- func LogDebug(ctx context.Context, message string)
- func LogDebugf(ctx context.Context, format string, args ...interface{})
- func LogError(ctx context.Context, message string)
- func LogErrorf(ctx context.Context, format string, args ...interface{})
- func LogFatal(ctx context.Context, message string)
- func LogFatalf(ctx context.Context, format string, args ...interface{})
- func LogInfo(ctx context.Context, message string)
- func LogInfof(ctx context.Context, format string, args ...interface{})
- func LogPrint(ctx context.Context, message string)
- func LogPrintf(ctx context.Context, format string, args ...interface{})
- func LogSetLogLevel(ctx context.Context, level logger.LogLevel)
- func LogTrace(ctx context.Context, message string)
- func LogTracef(ctx context.Context, format string, args ...interface{})
- func LogWarning(ctx context.Context, message string)
- func LogWarningf(ctx context.Context, format string, args ...interface{})
- func MenuSetApplicationMenu(ctx context.Context, menu *menu.Menu)
- func MenuUpdateApplicationMenu(ctx context.Context)
- func MessageDialog(ctx context.Context, dialogOptions MessageDialogOptions) (string, error)
- func OnFileDrop(ctx context.Context, callback func(x, y int, paths []string))
- func OnFileDropOff(ctx context.Context)
- func OnNotificationResponse(ctx context.Context, callback func(result NotificationResult))
- func OpenDirectoryDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)
- func OpenFileDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)
- func OpenMultipleFilesDialog(ctx context.Context, dialogOptions OpenDialogOptions) ([]string, error)
- func Quit(ctx context.Context)
- func RegisterNotificationCategory(ctx context.Context, category NotificationCategory) error
- func RemoveAllDeliveredNotifications(ctx context.Context) error
- func RemoveAllPendingNotifications(ctx context.Context) error
- func RemoveDeliveredNotification(ctx context.Context, identifier string) error
- func RemoveNotification(ctx context.Context, identifier string) error
- func RemoveNotificationCategory(ctx context.Context, categoryId string) error
- func RemovePendingNotification(ctx context.Context, identifier string) error
- func RequestNotificationAuthorization(ctx context.Context) (bool, error)
- func ResetSignalHandlers()
- func SaveFileDialog(ctx context.Context, dialogOptions SaveDialogOptions) (string, error)
- func SendNotification(ctx context.Context, options NotificationOptions) error
- func SendNotificationWithActions(ctx context.Context, options NotificationOptions) error
- func Show(ctx context.Context)
- func WindowCenter(ctx context.Context)
- func WindowExecJS(ctx context.Context, js string)
- func WindowFullscreen(ctx context.Context)
- func WindowGetPosition(ctx context.Context) (int, int)
- func WindowGetSize(ctx context.Context) (int, int)
- func WindowHide(ctx context.Context)
- func WindowIsFullscreen(ctx context.Context) bool
- func WindowIsMaximised(ctx context.Context) bool
- func WindowIsMinimised(ctx context.Context) bool
- func WindowIsNormal(ctx context.Context) bool
- func WindowMaximise(ctx context.Context)
- func WindowMinimise(ctx context.Context)
- func WindowPrint(ctx context.Context)
- func WindowReload(ctx context.Context)
- func WindowReloadApp(ctx context.Context)
- func WindowSetAlwaysOnTop(ctx context.Context, b bool)
- func WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8)
- func WindowSetDarkTheme(ctx context.Context)
- func WindowSetLightTheme(ctx context.Context)
- func WindowSetMaxSize(ctx context.Context, width int, height int)
- func WindowSetMinSize(ctx context.Context, width int, height int)
- func WindowSetPosition(ctx context.Context, x int, y int)
- func WindowSetSize(ctx context.Context, width int, height int)
- func WindowSetSystemDefaultTheme(ctx context.Context)
- func WindowSetTitle(ctx context.Context, title string)
- func WindowShow(ctx context.Context)
- func WindowToggleMaximise(ctx context.Context)
- func WindowUnfullscreen(ctx context.Context)
- func WindowUnmaximise(ctx context.Context)
- func WindowUnminimise(ctx context.Context)
- type DialogType
- type EnvironmentInfo
- type FileFilter
- type MessageDialogOptions
- type NotificationAction
- type NotificationCategory
- type NotificationOptions
- type NotificationResponse
- type NotificationResult
- type OpenDialogOptions
- type SaveDialogOptions
- type Screen
Constants ¶
const ( InfoDialog = frontend.InfoDialog WarningDialog = frontend.WarningDialog ErrorDialog = frontend.ErrorDialog QuestionDialog = frontend.QuestionDialog )
Variables ¶
This section is empty.
Functions ¶
func BrowserOpenURL ¶
BrowserOpenURL uses the system default browser to open the url
func CheckNotificationAuthorization ¶ added in v2.12.0
CheckNotificationAuthorization checks the current notification authorization status. On macOS, this checks if the app has notification permissions. On other platforms, this always returns true.
func CleanupNotifications ¶ added in v2.12.0
CleanupNotifications cleans up notification resources and releases any held connections. This should be called when shutting down the application to properly release resources (primarily needed on Linux to close D-Bus connections).
func ClipboardSetText ¶ added in v2.4.0
func EventsEmit ¶
EventsEmit pass through
func EventsOff ¶
EventsOff unregisters a listener for the given event name, optionally multiple listeners can be unregistered via `additionalEventNames`
func EventsOffAll ¶ added in v2.2.0
EventsOff unregisters a listener for the given event name, optionally multiple listeners can be unregistered via `additionalEventNames`
func EventsOn ¶
func EventsOn(ctx context.Context, eventName string, callback func(optionalData ...interface{})) func()
EventsOn registers a listener for the given event name. It returns a function to cancel the listener
func EventsOnMultiple ¶
func EventsOnMultiple(ctx context.Context, eventName string, callback func(optionalData ...interface{}), counter int) func()
EventsOnMultiple registers a listener for the given event name, that may be called a maximum of 'counter' times. It returns a function to cancel the listener
func EventsOnce ¶
func EventsOnce(ctx context.Context, eventName string, callback func(optionalData ...interface{})) func()
EventsOnce registers a listener for the given event name. After the first callback, the listener is deleted. It returns a function to cancel the listener
func InitializeNotifications ¶ added in v2.12.0
InitializeNotifications initializes the notification service for the application. This must be called before sending any notifications. On macOS, this also ensures the notification delegate is properly initialized.
func IsNotificationAvailable ¶ added in v2.12.0
IsNotificationAvailable checks if notifications are available on the current platform.
func LogSetLogLevel ¶
LogSetLogLevel sets the log level
func LogWarning ¶
LogWarning prints a Warning level message
func LogWarningf ¶
LogWarningf prints a Warning level message
func MessageDialog ¶
func MessageDialog(ctx context.Context, dialogOptions MessageDialogOptions) (string, error)
MessageDialog show a message dialog to the user
func OnFileDrop ¶ added in v2.9.0
OnFileDrop returns a slice of file path strings when a drop is finished.
func OnFileDropOff ¶ added in v2.9.0
OnFileDropOff removes the drag and drop listeners and handlers.
func OnNotificationResponse ¶ added in v2.12.0
func OnNotificationResponse(ctx context.Context, callback func(result NotificationResult))
OnNotificationResponse registers a callback function that will be invoked when a user interacts with a notification (e.g., clicks an action button or the notification itself). The callback receives a NotificationResult containing the response details or any errors.
func OpenDirectoryDialog ¶
func OpenDirectoryDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)
OpenDirectoryDialog prompts the user to select a directory
func OpenFileDialog ¶
func OpenFileDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)
OpenFileDialog prompts the user to select a file
func OpenMultipleFilesDialog ¶
func OpenMultipleFilesDialog(ctx context.Context, dialogOptions OpenDialogOptions) ([]string, error)
OpenMultipleFilesDialog prompts the user to select a file
func RegisterNotificationCategory ¶ added in v2.12.0
func RegisterNotificationCategory(ctx context.Context, category NotificationCategory) error
RegisterNotificationCategory registers a notification category that can be used with SendNotificationWithActions. Categories define the action buttons and optional reply fields that will appear on notifications.
func RemoveAllDeliveredNotifications ¶ added in v2.12.0
RemoveAllDeliveredNotifications removes all delivered notifications from the notification center. On Windows, this is a no-op as the platform manages notification lifecycle automatically.
func RemoveAllPendingNotifications ¶ added in v2.12.0
RemoveAllPendingNotifications removes all pending notifications from the notification center. On Windows, this is a no-op as the platform manages notification lifecycle automatically.
func RemoveDeliveredNotification ¶ added in v2.12.0
RemoveDeliveredNotification removes a specific delivered notification by its identifier. On Windows, this is a no-op as the platform manages notification lifecycle automatically.
func RemoveNotification ¶ added in v2.12.0
RemoveNotification removes a notification by its identifier. This is a convenience function that works across platforms. On macOS, use the more specific RemovePendingNotification or RemoveDeliveredNotification functions.
func RemoveNotificationCategory ¶ added in v2.12.0
RemoveNotificationCategory removes a previously registered notification category.
func RemovePendingNotification ¶ added in v2.12.0
RemovePendingNotification removes a specific pending notification by its identifier. On Windows, this is a no-op as the platform manages notification lifecycle automatically.
func RequestNotificationAuthorization ¶ added in v2.12.0
RequestNotificationAuthorization requests notification authorization from the user. On macOS, this prompts the user to allow notifications. On other platforms, this always returns true. Returns true if authorization was granted, false otherwise.
func ResetSignalHandlers ¶ added in v2.12.0
func ResetSignalHandlers()
ResetSignalHandlers resets signal handlers to allow panic recovery.
On Linux, WebKit (used for the webview) may install signal handlers without the SA_ONSTACK flag, which prevents Go from properly recovering from panics caused by nil pointer dereferences or other memory access violations.
Call this function immediately before code that might panic to ensure the signal handlers are properly configured for Go's panic recovery mechanism.
Example usage:
go func() {
defer func() {
if err := recover(); err != nil {
log.Printf("Recovered from panic: %v", err)
}
}()
runtime.ResetSignalHandlers()
// Code that might panic...
}()
Note: This function only has an effect on Linux. On other platforms, it is a no-op.
func SaveFileDialog ¶
func SaveFileDialog(ctx context.Context, dialogOptions SaveDialogOptions) (string, error)
SaveFileDialog prompts the user to select a file
func SendNotification ¶ added in v2.12.0
func SendNotification(ctx context.Context, options NotificationOptions) error
SendNotification sends a basic notification with the given options. The notification will display with the provided title, subtitle (if supported), and body text.
func SendNotificationWithActions ¶ added in v2.12.0
func SendNotificationWithActions(ctx context.Context, options NotificationOptions) error
SendNotificationWithActions sends a notification with action buttons. A NotificationCategory must be registered first using RegisterNotificationCategory. The options.CategoryID must match a previously registered category ID. If the category is not found, a basic notification will be sent instead.
func WindowCenter ¶
WindowCenter the window on the current screen
func WindowExecJS ¶ added in v2.1.0
WindowExecJS executes the given Js in the window
func WindowFullscreen ¶
WindowFullscreen makes the window fullscreen
func WindowIsFullscreen ¶
WindowIsFullscreen get the window state is window Fullscreen
func WindowIsMaximised ¶
WindowIsMaximised get the window state is window Maximised
func WindowIsMinimised ¶
WindowIsMinimised get the window state is window Minimised
func WindowIsNormal ¶
WindowIsNormal get the window state is window Normal
func WindowPrint ¶ added in v2.6.0
func WindowReload ¶
WindowReload will reload the window contents
func WindowReloadApp ¶
WindowReloadApp will reload the application
func WindowSetAlwaysOnTop ¶
WindowSetAlwaysOnTop sets the window AlwaysOnTop or not on top
func WindowSetDarkTheme ¶
func WindowSetLightTheme ¶
func WindowSetMaxSize ¶
WindowSetMaxSize sets the maximum size of the window
func WindowSetMinSize ¶
WindowSetMinSize sets the minimum size of the window
func WindowSetPosition ¶
WindowSetPosition sets the position of the window
func WindowSetSize ¶
WindowSetSize sets the size of the window
func WindowSetTitle ¶
WindowSetTitle sets the title of the window
func WindowToggleMaximise ¶
WindowToggleMaximise the window
func WindowUnfullscreen ¶
WindowUnfullscreen makes the window UnFullscreen
Types ¶
type DialogType ¶
type DialogType = frontend.DialogType
type EnvironmentInfo ¶
type EnvironmentInfo struct {
BuildType string `json:"buildType"`
Platform string `json:"platform"`
Arch string `json:"arch"`
}
EnvironmentInfo contains information about the environment
func Environment ¶
func Environment(ctx context.Context) EnvironmentInfo
Environment returns information about the environment
type FileFilter ¶
type FileFilter = frontend.FileFilter
FileFilter defines a filter for dialog boxes
type MessageDialogOptions ¶
type MessageDialogOptions = frontend.MessageDialogOptions
MessageDialogOptions contains the options for the Message dialogs, EG Info, Warning, etc runtime methods
type NotificationAction ¶ added in v2.12.0
type NotificationAction = frontend.NotificationAction
NotificationAction represents an action button for a notification.
type NotificationCategory ¶ added in v2.12.0
type NotificationCategory = frontend.NotificationCategory
NotificationCategory groups actions for notifications.
type NotificationOptions ¶ added in v2.12.0
type NotificationOptions = frontend.NotificationOptions
NotificationOptions contains configuration for a notification.
type NotificationResponse ¶ added in v2.12.0
type NotificationResponse = frontend.NotificationResponse
NotificationResponse represents the response sent by interacting with a notification.
type NotificationResult ¶ added in v2.12.0
type NotificationResult = frontend.NotificationResult
NotificationResult represents the result of a notification response, returning the response or any errors that occurred.
type OpenDialogOptions ¶
type OpenDialogOptions = frontend.OpenDialogOptions
OpenDialogOptions contains the options for the OpenDialogOptions runtime method
type SaveDialogOptions ¶
type SaveDialogOptions = frontend.SaveDialogOptions
SaveDialogOptions contains the options for the SaveDialog runtime method