gui/pkg/keybinding/platform.go
Snider 3954725d45 feat(keybinding): add keybinding core.Service with Platform interface and IPC
Implements pkg/keybinding with three-layer pattern: IPC Bus -> Service -> Platform.
Service maintains in-memory registry, ErrAlreadyRegistered on duplicates.
QueryList reads from service registry, not platform.GetAll().
ActionTriggered broadcast on shortcut trigger via platform callback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 14:34:30 +00:00

18 lines
756 B
Go

// pkg/keybinding/platform.go
package keybinding
// Platform abstracts the keyboard shortcut backend (Wails v3).
type Platform interface {
// Add registers a global keyboard shortcut with the given accelerator string.
// The handler is called when the shortcut is triggered.
// Accelerator syntax is platform-aware: "Cmd+S" (macOS), "Ctrl+S" (Windows/Linux).
// Special keys: F1-F12, Escape, Enter, Space, Tab, Backspace, Delete, arrow keys.
Add(accelerator string, handler func()) error
// Remove unregisters a previously registered keyboard shortcut.
Remove(accelerator string) error
// GetAll returns all currently registered accelerator strings.
// Used for adapter-level reconciliation only — not read by QueryList.
GetAll() []string
}