Some checks failed
Security Scan / security (push) Failing after 28s
- display/events.go: encoding/json → core.JSONMarshal/JSONUnmarshal - display/display.go: os, filepath → core.Env, core.JoinPath - window/layout.go: encoding/json, os, filepath → core primitives - window/state.go: encoding/json, os, filepath → core primitives All 17 packages build and test clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
package keybinding
|
|
|
|
import core "dappco.re/go/core"
|
|
|
|
var ErrorAlreadyRegistered = core.E("keybinding", "accelerator already registered", nil)
|
|
var ErrorNotRegistered = core.E("keybinding", "accelerator not registered", nil)
|
|
|
|
// BindingInfo describes a registered global key binding.
|
|
type BindingInfo struct {
|
|
Accelerator string `json:"accelerator"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
// QueryList returns all registered key bindings. Result: []BindingInfo
|
|
type QueryList struct{}
|
|
|
|
// TaskAdd registers a global key binding. Error: ErrorAlreadyRegistered if accelerator taken.
|
|
type TaskAdd struct {
|
|
Accelerator string `json:"accelerator"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
// TaskRemove unregisters a global key binding by accelerator. Error: ErrorNotRegistered if not found.
|
|
type TaskRemove struct {
|
|
Accelerator string `json:"accelerator"`
|
|
}
|
|
|
|
// TaskProcess triggers a registered key binding programmatically.
|
|
// Returns ActionTriggered if the accelerator was handled, ErrorNotRegistered if not found.
|
|
//
|
|
// c.PERFORM(keybinding.TaskProcess{Accelerator: "Ctrl+S"})
|
|
type TaskProcess struct {
|
|
Accelerator string `json:"accelerator"`
|
|
}
|
|
|
|
// ActionTriggered is broadcast when a registered key binding fires.
|
|
type ActionTriggered struct {
|
|
Accelerator string `json:"accelerator"`
|
|
}
|