- Fix window/service.go: replace 3 fmt.Errorf calls with coreerr.E() (removes implicit fmt dependency)
- Add usage-example comments to all bare Register() functions across 10 packages
- Remove redundant prose comments (Options/Service/Register/OnStartup/HandleIPCEvents boilerplate)
- Add Result-type comments to message types in contextmenu, keybinding, notification packages
- Fix test naming to TestFilename_Function_{Good,Bad,Ugly} pattern in display_test, window_test, persistence_test, service_screen_test
- Convert New() and CreateWindowOptions doc comments to usage-example style
Co-Authored-By: Virgil <virgil@lethean.io>
31 lines
888 B
Go
31 lines
888 B
Go
package contextmenu
|
|
|
|
import "errors"
|
|
|
|
var ErrorMenuNotFound = errors.New("contextmenu: menu not found")
|
|
|
|
// QueryGet returns a named context menu definition. Result: *ContextMenuDef (nil if not found)
|
|
type QueryGet struct {
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
// QueryList returns all registered context menus. Result: map[string]ContextMenuDef
|
|
type QueryList struct{}
|
|
|
|
// TaskAdd registers a named context menu. Replaces if already exists.
|
|
type TaskAdd struct {
|
|
Name string `json:"name"`
|
|
Menu ContextMenuDef `json:"menu"`
|
|
}
|
|
|
|
// TaskRemove unregisters a context menu by name. Error: ErrorMenuNotFound if missing.
|
|
type TaskRemove struct {
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
// ActionItemClicked is broadcast when a context menu item is clicked.
|
|
type ActionItemClicked struct {
|
|
MenuName string `json:"menuName"`
|
|
ActionID string `json:"actionId"`
|
|
Data string `json:"data,omitempty"`
|
|
}
|