Skip to content

Copy content to system clipboard via TTY and terminal using ANSI OSC52 sequence

License

Notifications You must be signed in to change notification settings

jirutka/tty-copy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tty-copy

Binaries Workflow Packaging status

A utility for copying content to the system clipboard from anywhere via a TTY and terminal using the ANSI OSC52 sequence. It works in any terminal session, whether local, remote (e.g. SSH), or even nested therein!

Refer to tty-copy(1) for usage information.

Supported Terminals

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

Terminal OSC 52 support

Alacritty

yes

Contour

yes

far2l

yes

foot

yes

GNOME Terminal (and other VTE-based terminals)

not yet

iTerm2

yes

kitty

yes

Konsole

yes (since 24.12)

QTerminal

not yet

rxvt

yes (to be confirmed)

screen

yes

Terminal.app

no, but see workaround

tmux

yes

urxvt

yes (with a script, see here)

Windows Terminal

yes

Requirements

Runtime:
  • UNIX-like system

Build:
  • C compiler and linker supporting at least C99 (tested with clang and gcc)

  • GNU Make

  • Asciidoctor (for building man pages)

Installation

On Alpine Linux

Install package tty-copy from the Alpine’s community repository:

apk add tty-copy

On Arch Linux

Install package tty-copy from AUR:

yay -S tty-copy

Or use another AUR helper.

On Fedora

Install package tty-copy from the Fedora repositories (since Fedora 35):

dnf install tty-copy

Using Pre-Built Binary

🐧 Linux: [x86_64] [aarch64] [armv7] [ppc64le] [riscv64]
macOS: [x86_64]

  1. Download and verify tty-copy binary for your CPU architecture (pick the right link from the list above), for example:

    curl -sSLO https://github.com/jirutka/tty-copy/releases/download/v0.2.2/tty-copy.x86_64-linux
    curl -sSL https://github.com/jirutka/tty-copy/releases/download/v0.2.2/checksums.txt | sha256sum -c --ignore-missing
  2. Install tty-copy somewhere on your PATH, e.g. /usr/local/bin:

    install -m 755 tty-copy.* /usr/local/bin/tty-copy

All binaries are statically linked with musl libc, so they work on every Linux system (distro) regardless of used libc.

From Source Tarball

wget https://github.com/jirutka/tty-copy/archive/v0.2.2/tty-copy-0.2.2.tar.gz
tar -xzf tty-copy-0.2.2.tar.gz
cd tty-copy-0.2.2

make build
make install DESTDIR=/ prefix=/usr/local

Credits

This program is inspired from termcopy and vim-oscyank.

License

This project is licensed under MIT License. For the full text of the license, see the LICENSE file.


1. This list was originally copied from vim-oscyank.