shcopy

Build Status Latest Release

Shell Copy is a simple utility that copies text to the clipboard from anywhere using ANSI OSC52 sequence. It works with local terminals (/dev/tty*) and remote terminals (SSH, Telnet).

Installation

Go Install

go install github.com/aymanbagabas/[email protected]

Homebrew

brew install aymanbagabas/tap/shcopy

Debian/Ubuntu

echo 'deb [trusted=yes] https://repo.aymanbagabas.com/apt/ /' | sudo tee /etc/apt/sources.list.d/aymanbagabas.list
sudo apt update && sudo apt install shcopy

Fedora

echo '[aymanbagabas]
name=Ayman Bagabas
baseurl=https://repo.aymanbagabas.com/yum/
enabled=1
gpgcheck=0' | sudo tee /etc/yum.repos.d/aymanbagabas.repo
sudo yum install shcopy

Supported Terminals

This is a non-exhaustive list of the status of popular terminal emulators regarding OSC52 1:

Terminal OSC52 support
Alacritty yes
foot yes
GNOME Terminal (and other VTE-based terminals) not yet
hterm (Chromebook) yes
iTerm2 yes
kitty yes
Konsole not yet
QTerminal not yet
screen yes
st yes (but needs to be enabled, see here)
Terminal.app no, but see workaround
tmux yes
Windows Terminal yes
rxvt yes (to be confirmed)
urxvt yes (with a script, see here)
xterm.js (Hyper terminal) not yet
wezterm yes

Tmux

Starting with tmux 3.3, the allow-passthrough option is disabled by default. This means that shcopy will not work in tmux by default. To enable it, add the following to your tmux config:

set -g allow-passthrough on

or use the following if you have set-clipboard on in your ~/.tmux.conf:

# set the terminal to default
echo "Hello, World!" | shcopy -t default

Credits

This project is built on top of go-osc52, based on vim-oscyank.

Footnotes

GitHub

View Github