gui/pkg/keybinding/messages.go
Snider 62ec735c10
Some checks failed
Security Scan / security (push) Has been cancelled
Test / test (push) Has been cancelled
refactor: AX compliance sweep — replace banned stdlib imports with core primitives
Replaced fmt, strings, sort, os, io, sync, encoding/json, path/filepath,
errors, log, reflect with core.Sprintf, core.E, core.Contains, core.Trim,
core.Split, core.Join, core.JoinPath, slices.Sort, c.Fs(), c.Lock(),
core.JSONMarshal, core.ReadAll and other CoreGO v0.8.0 primitives.

Framework boundary exceptions preserved where stdlib types are required
by external interfaces (Gin, net/http, CGo, Wails, bubbletea).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-13 09:32:01 +01:00

40 lines
1.1 KiB
Go

// pkg/keybinding/messages.go
package keybinding
import corego "dappco.re/go/core"
// ErrAlreadyRegistered is returned when attempting to add a binding
// that already exists. Callers must TaskRemove first to rebind.
var ErrAlreadyRegistered = corego.NewError("keybinding: accelerator already registered")
// BindingInfo describes a registered keyboard shortcut.
type BindingInfo struct {
Accelerator string `json:"accelerator"`
Description string `json:"description"`
}
// --- Queries ---
// QueryList returns all registered bindings. Result: []BindingInfo
type QueryList struct{}
// --- Tasks ---
// TaskAdd registers a new keyboard shortcut. Result: nil
// Returns ErrAlreadyRegistered if the accelerator is already bound.
type TaskAdd struct {
Accelerator string `json:"accelerator"`
Description string `json:"description"`
}
// TaskRemove unregisters a keyboard shortcut. Result: nil
type TaskRemove struct {
Accelerator string `json:"accelerator"`
}
// --- Actions ---
// ActionTriggered is broadcast when a registered shortcut is activated.
type ActionTriggered struct {
Accelerator string `json:"accelerator"`
}