cacooclip

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 3 Imported by: 0

README

cacooclip

Fork of Changkun Ou's golang-design/clipboard that handles clipboard data from Chrome with Cacoo Editor's custom web MIME type, on MacOS only.

Yes, it is very specialized to work on my machine. It might or might not support more OS'es and browsers in the future.

Features

The Cacoo Editor supports copy and paste of shapes to/from the system clipboard by using a custom MIME type. When you CTRL+C a shape, you can only CTRL+V it in the Cacoo Editor. The cacooclip program allows you to read the raw shape data from the clipboard and output it as JSON text.

Usage

This fork is designed as a command line program or as a library.

Command line:
go install github.com/vibridi/cacooclip/cmd/cacooclip@latest

or from the cloned repo:

$ make build

then move the binary into your path. Copy a shape from the Cacoo Editor then run:

$ cacooclip -r

The command will print the Cacoo shape data to stdout. To write data, select and copy the shape data as JSON text and (on MacOS) run:

$ pbpaste | cacooclip -w
Library:
$ go get github.com/vibridi/cacooclip

and then call it as:

str, err := cacooclip.Read()
if err != nil {
	// ...
}
err = cacooclip.Write(str)
if err != nil {
	// ...
}
License

MIT | © 2021 The golang.design Initiative Authors, written by Changkun Ou (original repo and the code that remains in this fork) and 2023 Gabriele V. (Nulab Inc.) (all modifications and additions committed to this fork)

Documentation

Index

Constants

View Source
const (
	CacooWebMIMEType = "cacoo/shape"
)

Variables

This section is empty.

Functions

func Read

func Read() (string, error)

Read reads Cacoo shape data from the clipboard. Not thread safe. Concurrent reads on some OS'es including Darwin may panic.

func Write

func Write(str string) error

Write writes Cacoo shape data to the clipboard so that you can CTRL+V directly onto the Cacoo canvas.

Types

This section is empty.

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL