Stabilize the tray icon and locale handling on Windows while aligning provider and alias management panels with the refreshed desktop branding.
58 lines
1.2 KiB
Go
58 lines
1.2 KiB
Go
//go:build desktop_wails
|
|
|
|
package desktop
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
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)
|
|
wruntime.WindowShow(ctx)
|
|
wruntime.WindowUnminimise(ctx)
|
|
wruntime.WindowSetAlwaysOnTop(ctx, true)
|
|
time.Sleep(80 * time.Millisecond)
|
|
wruntime.WindowSetAlwaysOnTop(ctx, false)
|
|
return nil
|
|
}
|
|
|
|
func quitWindow(ctx context.Context) error {
|
|
wruntime.Quit(ctx)
|
|
return nil
|
|
}
|
|
|
|
func openExternalURL(ctx context.Context, url string) error {
|
|
wruntime.BrowserOpenURL(ctx, url)
|
|
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,
|
|
})
|
|
}
|