Fork. This is atotto/clipboard with one file added:
clipboard_js.go, thejs && wasmcase. Upstream has darwin, unix, windows and plan9 branches and no fallback, so the package does not compile forjs/wasmat all — which is what stopsbubblesandhuhcompiling, throughtextinput.Writing goes to
navigator.clipboard. Reading cannot:readTextis async and a wasm module has one thread, so awaiting it deadlocks the page. The host primes the value from its own paste handler instead.The module path is
github.com/0magnet/clipboardso it can be areplacetarget.
Provide copying and pasting to the Clipboard for Go.
Build:
$ go get github.com/atotto/clipboard
Platforms:
- OSX
- Windows 7 (probably work on other Windows)
- Linux, Unix (requires 'xclip' or 'xsel' command to be installed)
Document:
Notes:
- Text string only
- UTF-8 text encoding only (no conversion)
TODO:
- Clipboard watcher(?)
paste shell command:
$ go install github.com/atotto/clipboard/cmd/gopaste@latest
$ # example:
$ gopaste > document.txt
copy shell command:
$ go install github.com/atotto/clipboard/cmd/gocopy@latest
$ # example:
$ cat document.txt | gocopy