diff --git a/.gitignore b/.gitignore index d561f40..e301e5c 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,8 @@ vendor # ## *.a !cdeps/mac/libpng.a +!cdeps/mac/amd/libpng.a +!cdeps/mac/m1/libpng.a !cdeps/win32/libpng.a !cdeps/win64/libpng.a # diff --git a/cdeps/mac/libpng.a b/cdeps/mac/amd/libpng.a similarity index 100% rename from cdeps/mac/libpng.a rename to cdeps/mac/amd/libpng.a diff --git a/cdeps/mac/m1/libpng.a b/cdeps/mac/m1/libpng.a new file mode 100644 index 0000000..ce2fd03 Binary files /dev/null and b/cdeps/mac/m1/libpng.a differ diff --git a/clipboard/example/example.go b/clipboard/example/example.go index f29304e..3b6cb37 100644 --- a/clipboard/example/example.go +++ b/clipboard/example/example.go @@ -7,14 +7,19 @@ import ( ) func main() { - clipboard.WriteAll("日本語") + err := clipboard.WriteAll("日本語") + if err != nil { + log.Println("clipboard write all error: ", err) + } + text, err := clipboard.ReadAll() if err != nil { log.Println("clipboard read all error: ", err) - } else { - if text != "" { - log.Println("text is: ", text) - // Output: 日本語 - } + return + } + + if text != "" { + log.Println("text is: ", text) + // Output: 日本語 } } diff --git a/robotgo.go b/robotgo.go index 554f64b..873ff69 100644 --- a/robotgo.go +++ b/robotgo.go @@ -27,7 +27,8 @@ package robotgo #cgo darwin CFLAGS: -x objective-c -Wno-deprecated-declarations #cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit #cgo darwin LDFLAGS: -framework Carbon -framework CoreFoundation - #cgo darwin LDFLAGS:-L${SRCDIR}/cdeps/mac -lpng -lz + #cgo darwin,amd64 LDFLAGS:-L${SRCDIR}/cdeps/mac/amd -lpng -lz + #cgo darwin,arm64 LDFLAGS:-L${SRCDIR}/cdeps/mac/m1 -lpng -lz //#elif defined(USE_X11) // Drop -std=c11 #cgo linux CFLAGS: -I/usr/src