mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-30 22:13:54 +00:00
add KeyTap() special key support
This commit is contained in:
parent
1de0de6dca
commit
3c8efddb74
35
keycode.go
35
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",
|
||||
"_": "-",
|
||||
"+": "=",
|
||||
"{": "[",
|
||||
"}": "]",
|
||||
"|": "\\",
|
||||
":": ";",
|
||||
`"`: "'",
|
||||
"<": ",",
|
||||
">": ".",
|
||||
"?": "/",
|
||||
}
|
||||
|
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user