Documentation
¶
Overview ¶
Package accelerator parses Electron style keyboard accelerators such as "CmdOrCtrl+Shift+Z" into a platform neutral representation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Accelerator ¶
type Accelerator struct {
Modifiers Modifiers
// Key is either a single lower case character ("a", "1", ",") or one of
// the named keys: F1-F24, Enter, Tab, Space, Backspace, Delete, Insert,
// Escape, Up, Down, Left, Right, Home, End, PageUp, PageDown,
// VolumeUp, VolumeDown, VolumeMute, MediaNextTrack, MediaPreviousTrack,
// MediaStop, MediaPlayPause, PrintScreen, Num0-Num9, NumDec, NumAdd,
// NumSub, NumMult, NumDiv, CapsLock, NumLock, ScrollLock.
Key string
}
Accelerator is a parsed accelerator.
func Parse ¶
func Parse(s, goos string) (Accelerator, error)
Parse parses an accelerator for the given GOOS. "CmdOrCtrl" resolves to Super (Command) on darwin and Ctrl elsewhere.
func (Accelerator) Has ¶
func (a Accelerator) Has(m Modifiers) bool
Has reports whether all modifiers in m are set.
func (Accelerator) Keysym ¶
func (a Accelerator) Keysym() string
Keysym returns the XKB (and X11) name of the key, as in "a", "comma", "Return", "F5" or "KP_Add".
func (Accelerator) String ¶
func (a Accelerator) String() string
String formats the accelerator in canonical form.
func (Accelerator) XDGTrigger ¶
func (a Accelerator) XDGTrigger() string
XDGTrigger formats the accelerator as a trigger of the XDG shortcuts specification, as in "CTRL+SHIFT+k", which desktop portals take.