Add: add cmd to the ctrl supported

This commit is contained in:
vcaesar 2022-12-15 08:58:17 -08:00
parent f4f4a3d319
commit e8b3975205
2 changed files with 11 additions and 2 deletions

View File

@ -1,14 +1,14 @@
package main
import (
"io/ioutil"
"io"
"os"
"github.com/go-vgo/robotgo/clipboard"
)
func main() {
out, err := ioutil.ReadAll(os.Stdin)
out, err := io.ReadAll(os.Stdin)
if err != nil {
panic(err)
}

9
key.go
View File

@ -322,6 +322,15 @@ var keyNames = map[string]C.MMKeyCode{
// { NULL: C.K_NOT_A_KEY }
}
// CmdCtrl If the operating system is macOS, return the key string "cmd",
// otherwise return the key string "ctrl
func CmdCtrl() string {
if runtime.GOOS == "darwin" {
return "cmd"
}
return "ctrl"
}
// It sends a key press and release to the active application
func tapKeyCode(code C.MMKeyCode, flags C.MMKeyFlags, pid C.uintptr) {
C.toggleKeyCode(code, true, flags, pid)