From e8b397520516585ce04bc17279a6370a048de24d Mon Sep 17 00:00:00 2001 From: vcaesar Date: Thu, 15 Dec 2022 08:58:17 -0800 Subject: [PATCH] Add: add cmd to the ctrl supported --- clipboard/cmd/gocopy/gocopy.go | 4 ++-- key.go | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/clipboard/cmd/gocopy/gocopy.go b/clipboard/cmd/gocopy/gocopy.go index 115672a..aaa9c30 100644 --- a/clipboard/cmd/gocopy/gocopy.go +++ b/clipboard/cmd/gocopy/gocopy.go @@ -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) } diff --git a/key.go b/key.go index f0b37a8..998452e 100644 --- a/key.go +++ b/key.go @@ -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)