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>
40 lines
1.1 KiB
Go
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"`
|
|
}
|