Documentation
¶
Index ¶
Constants ¶
View Source
const ( CommandLeft KeyboardModifier = 54 CommandRight = 55 ShiftLeft = 56 OptionLeft = 58 ControlLeft = 59 ShiftRight = 60 OptionRight = 61 ControlRight = 62 Fn = 63 )
Variables ¶
View Source
var SpecialKeyMap = map[KeyboardModifier]string{
53: "⎋",
122: "F1",
120: "F2",
99: "F3",
118: "F4",
96: "F5",
97: "F6",
98: "F7",
100: "F8",
101: "F9",
109: "F10",
103: "F11",
111: "F12",
105: "F13",
107: "F14",
113: "F15",
106: "F16",
64: "F17",
79: "F18",
80: "F19",
90: "F20",
51: "⌫",
36: "↩",
76: "↩",
114: "?⃝",
117: "⌦",
115: "↖",
119: "↘",
116: "⇞",
121: "⇟",
123: "←",
124: "→",
125: "↓",
126: "↑",
71: "⌧",
}
Some keys may not trigger a key down event (and can only be detected on a key up event) or may not require a modifier. https://github.com/robotn/gohook/issues/26 http://macbiblioblog.blogspot.com/2014/12/key-codes-for-function-and-special-keys.html
Functions ¶
func HandleEvents ¶
func HandleEvents(onEvent EventHandler)
Types ¶
type EventHandler ¶
type EventHandler = func(keyboardEvent KeyboardEvent)
type KeyboardEvent ¶
type KeyboardEvent struct {
Character string `json:"character"`
Code uint16 `json:"code"`
Modifiers KeyboardEventModifiers `json:"modifiers"`
}
type KeyboardEventModifiers ¶
type KeyboardModifier ¶
type KeyboardModifier = uint16
type KeyboardModifiers ¶
type KeyboardModifiers = map[KeyboardModifier]hook.Event
Click to show internal directories.
Click to hide internal directories.