1
0
forked from gmp/clip
clip/main.go
2019-10-01 09:33:35 -04:00

35 lines
486 B
Go

package clip
import (
"git.wow.st/gmp/clip/ns"
)
var pb *ns.NSPasteboard
func Clear() {
if pb == nil {
pb = ns.NSPasteboardGeneralPasteboard()
}
pb.ClearContents()
}
func Set(x string) bool {
if pb == nil {
pb = ns.NSPasteboardGeneralPasteboard()
}
pb.ClearContents()
return pb.SetString(x)
}
func Get() string {
if pb == nil {
pb = ns.NSPasteboardGeneralPasteboard()
}
ret := pb.GetString()
if ret.Ptr() == nil {
return ""
} else {
return ret.String()
}
}