gui/pkg/dock/platform.go
Claude a9b795f223
Some checks failed
Security Scan / security (push) Failing after 29s
Test / test (push) Successful in 2m9s
feat: Wails v3 stub bridge + feature expansion + display bridge + MCP events
Stubs (15 files, 479 exports):
- All managers: Dialog, Event, Browser, Clipboard, ContextMenu, Environment, Screen, KeyBinding
- Window interface (~50 methods), BrowserWindow, platform options (iOS/Android)
- MenuItem (42 roles), WebviewWindowOptions (full platform types)
- Wails v3 submodule pinned at alpha 74

New events package (17th package):
- Custom event system bridged to Core IPC
- TaskEmit, TaskOn, TaskOff, QueryListeners, ActionEventFired

Feature expansions:
- Window: zoom, content (SetURL/SetHTML/ExecJS), bounds, print, flash
- Screen: QueryCurrent, ScreenPlacement, Rect geometry
- Dialog: typed tasks, file options, Info/Question/Warning/Error
- Keybinding: TaskProcess, ErrorNotRegistered
- Notification: RevokePermission, RegisterCategory, action broadcasts
- Dock: SetProgressBar, Bounce/StopBounce
- Environment: HasFocusFollowsMouse
- ContextMenu: QueryGetAll, TaskUpdate, TaskDestroy

Display bridge: 5 new event types wired to WebSocket
MCP: 4 event tools (emit, on, off, list)

17 packages build and test clean (1 flaky test ordering issue in window).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:42:09 +01:00

35 lines
1.3 KiB
Go

// pkg/dock/platform.go
package dock
// BounceType controls the style of the macOS dock icon bounce animation.
type BounceType int
const (
// BounceInformational bounces the dock icon once briefly.
BounceInformational BounceType = iota
// BounceCritical bounces the dock icon continuously until the app is focused.
BounceCritical
)
// Platform abstracts the dock/taskbar backend (Wails v3).
// macOS: dock icon show/hide + badge + bounce + progress.
// Windows: taskbar badge and progress only (show/hide/bounce not supported).
// Linux: not supported — adapter returns nil for all operations.
type Platform interface {
ShowIcon() error
HideIcon() error
SetBadge(label string) error
RemoveBadge() error
IsVisible() bool
// SetProgressBar sets a progress indicator on the dock/taskbar icon.
// value is in the range [0.0, 1.0]. Use -1.0 to remove the progress bar.
// p.SetProgressBar(0.5) // 50% progress
SetProgressBar(value float64) error
// Bounce animates the dock icon to attract the user's attention.
// bounceType controls whether the animation loops (BounceCritical) or plays once (BounceInformational).
// Returns a bounce ID that can be passed to StopBounce.
Bounce(bounceType BounceType) (int, error)
// StopBounce cancels a running bounce animation identified by bounceID.
// p.StopBounce(id)
StopBounce(bounceID int) error
}