Documentation
¶
Overview ¶
pkg/keybinding/platform.go
pkg/keybinding/service.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorAlreadyRegistered = core.E("keybinding", "accelerator already registered", nil)
View Source
var ErrorNotRegistered = core.E("keybinding", "accelerator not registered", nil)
Functions ¶
Types ¶
type ActionTriggered ¶
type ActionTriggered struct {
Accelerator string `json:"accelerator"`
}
ActionTriggered is broadcast when a registered key binding fires.
type BindingInfo ¶
type BindingInfo struct {
Accelerator string `json:"accelerator"`
Description string `json:"description"`
}
BindingInfo describes a registered global key binding.
type Platform ¶
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
// Process triggers the registered handler for the given accelerator programmatically.
// Returns true if a handler was found and invoked, false if not registered.
//
// handled := platform.Process("Ctrl+S")
Process(accelerator string) bool
// GetAll returns all currently registered accelerator strings.
// Used for adapter-level reconciliation only — not read by QueryList.
GetAll() []string
}
Platform abstracts the keyboard shortcut backend (Wails v3).
type QueryList ¶
type QueryList struct{}
QueryList returns all registered key bindings. Result: []BindingInfo
type Service ¶
type Service struct {
*core.ServiceRuntime[Options]
// contains filtered or unexported fields
}
func (*Service) HandleIPCEvents ¶
type TaskAdd ¶
type TaskAdd struct {
Accelerator string `json:"accelerator"`
Description string `json:"description"`
}
TaskAdd registers a global key binding. Error: ErrorAlreadyRegistered if accelerator taken.
type TaskProcess ¶
type TaskProcess 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 TaskRemove ¶
type TaskRemove struct {
Accelerator string `json:"accelerator"`
}
TaskRemove unregisters a global key binding by accelerator. Error: ErrorNotRegistered if not found.
Click to show internal directories.
Click to hide internal directories.