osc52
A command line tool to access the system clipboard from anywhere on the command line using the ANSI OSC52 sequence.
System clipboard access includes writing (i.e. copy) and reading (i.e. paste), even while logged into a remote machine via ssh.
Usage
Reads or writes the system clipboard using the ANSI OSC52 escape sequence.
Usage:
COPY mode (default):
osc52 [file1 [...fileN]]
With no arguments, will read from stdin.
PASTE mode:
osc52 --paste
Outputs clipboard contents to stdout.
Options:
-logFile string
redirect logs to file
-paste
paste operation
-v verbose logging
-verbose
verbose logging
Compatibility
OSC52 is overall widely supported, but clipboard read operation is less widely supported than write.
| Terminal |
Terminal OS |
Shell OS |
Copy |
Paste |
Notes |
| alacritty 0.12.2 |
macOS |
linux |
✓ |
✓ |
|
| alacritty 0.12.2 |
macOS |
macOS |
✓ |
✓ |
|
| alacritty 0.12.0 |
Windows |
linux |
✓ |
✗ |
|
| kitty 0.29.0 |
macOS |
linux |
✓ |
✓ |
Prompts for access |
| kitty 0.29.0 |
macOS |
macOS |
✓ |
✓ |
Prompts for access |
| iterm2 |
macOS |
linux |
✓ |
✓ |
Paste requires version 3.5.0 (currently beta). Prompts for access. |
| iterm2 |
macOS |
macOS |
✓ |
✓ |
Paste requires version 3.5.0 (currently beta). Prompts for access. |
| hterm |
ChromeOS |
linux |
✓ |
✗ |
|
Terminal Multiplexer support
Using alacritty as the terminal,
default configuration options for multiplexer:
| Terminal Multiplexer |
Copy |
Paste |
Notes |
| screen 4.09.00 |
✓ |
✓ |
|
| zellij 0.37.2 |
✓ |
✗ |
|
| tmux 3.2a |
✗ |
✗ |
May require configuration |
Installation
go 1.16 or later:
go install -v github.com/theimpostor/osc52@latest
go 1.15 or earlier:
GO111MODULE=on go get github.com/theimpostor/osc52@latest
This will install the latest version of osc52 to $GOPATH/bin. To find out where $GOPATH is, run go env GOPATH
TODO
- [copy] check is stdin is readable
- tmux support
- subcommands
Credits