Bring the Wails desktop shell to feature parity with the CLI for provider and alias management while keeping the browser fallback working. Wire tray, notifications, autostart, and GUI warnings so desktop flows behave predictably.
47 lines
909 B
Go
47 lines
909 B
Go
//go:build desktop_wails
|
|
|
|
package desktop
|
|
|
|
import (
|
|
"context"
|
|
|
|
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
|
)
|
|
|
|
type desktopNotification struct {
|
|
ID string
|
|
Title string
|
|
Body string
|
|
}
|
|
|
|
func hideWindow(ctx context.Context) error {
|
|
wruntime.Hide(ctx)
|
|
return nil
|
|
}
|
|
|
|
func showWindow(ctx context.Context) error {
|
|
wruntime.Show(ctx)
|
|
return nil
|
|
}
|
|
|
|
func quitWindow(ctx context.Context) error {
|
|
wruntime.Quit(ctx)
|
|
return nil
|
|
}
|
|
|
|
func initDesktopNotifications(ctx context.Context) error {
|
|
return wruntime.InitializeNotifications(ctx)
|
|
}
|
|
|
|
func desktopNotificationsAvailable(ctx context.Context) bool {
|
|
return wruntime.IsNotificationAvailable(ctx)
|
|
}
|
|
|
|
func sendDesktopNotification(ctx context.Context, notification desktopNotification) error {
|
|
return wruntime.SendNotification(ctx, wruntime.NotificationOptions{
|
|
ID: notification.ID,
|
|
Title: notification.Title,
|
|
Body: notification.Body,
|
|
})
|
|
}
|