diff --git a/docs/keys.md b/docs/keys.md index fcfe3f62..27528336 100644 --- a/docs/keys.md +++ b/docs/keys.md @@ -100,18 +100,18 @@ "num_enter" "num_equal" - // "numpad_0" No Linux support - "numpad_0" - "numpad_1" - "numpad_2" - "numpad_3" - "numpad_4" - "numpad_5" - "numpad_6" - "numpad_7" - "numpad_8" - "numpad_9" - "numpad_lock" + // // "numpad_0" No Linux support + // "numpad_0" + // "numpad_1" + // "numpad_2" + // "numpad_3" + // "numpad_4" + // "numpad_5" + // "numpad_6" + // "numpad_7" + // "numpad_8" + // "numpad_9" + // "numpad_lock" "lights_mon_up" Turn up monitor brightness No Windows support "lights_mon_down" Turn down monitor brightness No Windows support diff --git a/keycode.go b/keycode.go index 4ec2d3b3..acc90bec 100644 --- a/keycode.go +++ b/keycode.go @@ -38,6 +38,7 @@ var Keycode = uMap{ "0": 11, "-": 12, "=": 13, + // "_": 12, "+": 13, // @@ -53,10 +54,11 @@ var Keycode = uMap{ "p": 25, "[": 26, "]": 27, - "{": 26, - "}": 27, "\\": 43, - "|": 43, + // + "{": 26, + "}": 27, + "|": 43, // "a": 30, "s": 31, @@ -69,6 +71,7 @@ var Keycode = uMap{ "l": 38, ";": 39, "'": 40, + // ":": 39, `"`: 40, // @@ -82,6 +85,7 @@ var Keycode = uMap{ ",": 51, ".": 52, "/": 53, + // "<": 51, ">": 52, "?": 53, @@ -120,3 +124,28 @@ var Keycode = uMap{ "left": 57419, "right": 57421, } + +// Special is the special key map +var Special = map[string]string{ + "~": "`", + "!": "1", + "@": "2", + "#": "3", + "$": "4", + "%": "5", + "^": "6", + "&": "7", + "*": "8", + "(": "9", + ")": "0", + "_": "-", + "+": "=", + "{": "[", + "}": "]", + "|": "\\", + ":": ";", + `"`: "'", + "<": ",", + ">": ".", + "?": "/", +} diff --git a/robotgo.go b/robotgo.go index 22387cbd..6d649b48 100644 --- a/robotgo.go +++ b/robotgo.go @@ -659,6 +659,13 @@ func KeyTap(tapKey string, args ...interface{}) string { keyDelay = 10 ) + if _, ok := Special[tapKey]; ok { + tapKey = Special[tapKey] + if len(args) <= 0 { + args = append(args, "shift") + } + } + // var ckeyArr []*C.char ckeyArr := make([](*C.char), 0) // zkey := C.CString(args[0])