Skip to content

Commit

Permalink
Merge pull request #387 from go-vgo/bitmap-pr
Browse files Browse the repository at this point in the history
add KeyTap() special key support and update docs
  • Loading branch information
vcaesar authored Nov 7, 2021
2 parents 94832ce + 3c8efdd commit 1b6fef9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 15 deletions.
24 changes: 12 additions & 12 deletions docs/keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 32 additions & 3 deletions keycode.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var Keycode = uMap{
"0": 11,
"-": 12,
"=": 13,
//
"_": 12,
"+": 13,
//
Expand All @@ -53,10 +54,11 @@ var Keycode = uMap{
"p": 25,
"[": 26,
"]": 27,
"{": 26,
"}": 27,
"\\": 43,
"|": 43,
//
"{": 26,
"}": 27,
"|": 43,
//
"a": 30,
"s": 31,
Expand All @@ -69,6 +71,7 @@ var Keycode = uMap{
"l": 38,
";": 39,
"'": 40,
//
":": 39,
`"`: 40,
//
Expand All @@ -82,6 +85,7 @@ var Keycode = uMap{
",": 51,
".": 52,
"/": 53,
//
"<": 51,
">": 52,
"?": 53,
Expand Down Expand Up @@ -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",
"_": "-",
"+": "=",
"{": "[",
"}": "]",
"|": "\\",
":": ";",
`"`: "'",
"<": ",",
">": ".",
"?": "/",
}
7 changes: 7 additions & 0 deletions robotgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 1b6fef9

Please sign in to comment.