package desktop import ( "context" "github.com/Apale7/opencode-provider-switch/internal/app" ) // Tray holds desktop resident-mode preferences. Wails v2 does not expose a // stable public tray API in the current pinned version, so this type currently // manages close-to-background behavior without depending on private APIs. type Tray struct { service *app.Service ctx context.Context prefs app.DesktopPrefsView } func NewTray(service *app.Service) *Tray { return &Tray{service: service} } func (t *Tray) Attach(ctx context.Context) { t.ctx = ctx } func (t *Tray) Detach() { t.ctx = nil } func (t *Tray) Sync(ctx context.Context, prefs app.DesktopPrefsView) { _ = ctx t.prefs = prefs } func (t *Tray) BeforeClose(ctx context.Context) (bool, error) { _ = ctx if !t.prefs.MinimizeToTray { return false, nil } return true, hideWindow(ctx) }