Skip to content

Access to the Mac clipboard in Go, using native APIs, not pbcopy/pbpaste

License

Notifications You must be signed in to change notification settings

HuckRidgeSW/clipboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

import 	"github.com/huckridgesw/clipboard"

Copy & Paste

// 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.

About

Access to the Mac clipboard in Go, using native APIs, not pbcopy/pbpaste

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages