https://github.com/huckridgesw/clipboard
Access to the Mac clipboard in Go, using native APIs, not pbcopy/pbpaste
https://github.com/huckridgesw/clipboard
clipboard darwin go macos
Last synced: about 2 months ago
JSON representation
Access to the Mac clipboard in Go, using native APIs, not pbcopy/pbpaste
- Host: GitHub
- URL: https://github.com/huckridgesw/clipboard
- Owner: HuckRidgeSW
- License: mit
- Created: 2019-12-03T00:46:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-03T01:59:42.000Z (over 6 years ago)
- Last Synced: 2025-01-09T11:25:43.573Z (over 1 year ago)
- Topics: clipboard, darwin, go, macos
- Language: Objective-C
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# clipboard
Access to the Mac clipboard (which it calls a pasteboard) in Go, using native
APIs, not pbcopy/pbpaste.
The Mac pasteboard stores items with a type (string, image, url, etc). This
library currently reads & writes only strings.
# Import
```go
import "github.com/huckridgesw/clipboard"
```
# Copy & Paste
```go
// write a string to the pasteboard -- "copy"
clipboard.Set("a string")
// read a string from the pasteboard -- "paste"
if s, ok := clipboard.Get(); ok {
// do something with s
}
```
`Get` will only fail (return with `ok` == `false`) if there are no strings in
the pasteboard, or your program runs out of memory and `malloc` returns `NULL`.