An open API service indexing awesome lists of open source software.

https://github.com/jirutka/tty-copy

Copy content to system clipboard via TTY and terminal using ANSI OSC52 sequence
https://github.com/jirutka/tty-copy

clipboard command-line-tool copy-paste osc52 terminal tty

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

          

= tty-copy
:proj-name: tty-copy
:version: 0.2.2
:gh-name: jirutka/{proj-name}
:releases-uri: https://github.com/{gh-name}/releases/download/v{version}

ifdef::env-github[]
image:https://github.com/{gh-name}/workflows/CI/badge.svg[Binaries Workflow, link=https://github.com/{gh-name}/actions?query=workflow%3A%22CI%22]
image:https://repology.org/badge/tiny-repos/{proj-name}.svg[Packaging status, link=https://repology.org/project/{proj-name}]
endif::env-github[]

A utility for copying content to the system clipboard from *anywhere* via a TTY and terminal using the https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands[ANSI OSC52] sequence.
It works in any terminal session, whether local, remote (e.g. SSH), or even nested therein!

Refer to link:tty-copy.1.adoc[tty-copy(1)] for usage information.

== Supported Terminals

Here is a non-exhaustive list of the status of popular terminal emulators regarding OSC52 footnote:[This list was originally copied from https://github.com/ojroques/vim-oscyank[vim-oscyank].]:

|===
| Terminal | OSC 52 support

| https://github.com/alacritty/alacritty[Alacritty]
| *yes*

| https://github.com/contour-terminal/contour[Contour]
| *yes*

| https://github.com/elfmz/far2l[far2l]
| *yes*

| https://codeberg.org/dnkl/foot[foot]
| *yes*

| https://github.com/GNOME/gnome-terminal[GNOME Terminal] (and other VTE-based terminals)
| https://bugzilla.gnome.org/show_bug.cgi?id=795774[not yet]

| https://iterm2.com/[iTerm2]
| *yes*

| https://github.com/kovidgoyal/kitty[kitty]
| *yes*

| https://konsole.kde.org[Konsole]
| *yes* (https://bugs.kde.org/show_bug.cgi?id=372116[since 24.12])

| https://github.com/lxqt/qterminal[QTerminal]
| https://github.com/lxqt/qterminal/issues/839[not yet]

| http://rxvt.sourceforge.net/[rxvt]
| *yes* (to be confirmed)

| https://www.gnu.org/software/screen/[screen]
| *yes*

| https://en.wikipedia.org/wiki/Terminal_(macOS)[Terminal.app]
| no, but see https://github.com/matvore/pb52[workaround]

| https://github.com/tmux/tmux[tmux]
| *yes*

| http://software.schmorp.de/pkg/rxvt-unicode.html[urxvt]
| *yes* (with a script, see https://github.com/ojroques/vim-oscyank/issues/4[here])

| https://github.com/microsoft/terminal[Windows Terminal]
| *yes*
|===

== Requirements

.*Runtime*:
* UNIX-like system

.*Build*:
* C compiler and linker supporting at least C99 (tested with clang and gcc)
* https://www.gnu.org/software/make/[GNU Make]
* http://asciidoctor.org/[Asciidoctor] (for building man pages)

== Installation

=== On Alpine Linux

Install package https://pkgs.alpinelinux.org/packages?name={proj-name}[{proj-name}] from the Alpine’s community repository:

[source, sh, subs="+attributes"]
apk add {proj-name}

=== On Arch Linux

Install package https://aur.archlinux.org/packages/{proj-name}[{proj-name}] from AUR:

[source, sh, subs="+attributes"]
yay -S {proj-name}

Or use another AUR helper.

=== On Fedora

Install package https://packages.fedoraproject.org/pkgs/{proj-name}/{proj-name}/[{proj-name}] from the Fedora repositories (since Fedora 35):

[source, sh, subs="+attributes"]
dnf install {proj-name}

=== Using Pre-Built Binary

🐧 *Linux*:
{releases-uri}/{proj-name}.x86_64-linux[[x86_64]]
{releases-uri}/{proj-name}.aarch64-linux[[aarch64]]
{releases-uri}/{proj-name}.armv7-linux[[armv7]]
{releases-uri}/{proj-name}.ppc64le-linux[[ppc64le]]
{releases-uri}/{proj-name}.riscv64-linux[[riscv64]] +
 *macOS*:
{releases-uri}/{proj-name}.x86_64-darwin[[x86_64]]

. Download and verify {proj-name} binary for your CPU architecture (pick the right link from the list above), for example:
+
[source, sh, subs="verbatim, attributes"]
----
curl -sSLO {releases-uri}/{proj-name}.x86_64-linux
curl -sSL {releases-uri}/checksums.txt | sha256sum -c --ignore-missing
----

. Install `{proj-name}` somewhere on your `PATH`, e.g. `/usr/local/bin`:
+
[source, sh, subs="verbatim, attributes"]
install -m 755 {proj-name}.* /usr/local/bin/{proj-name}

All binaries are statically linked with http://www.musl-libc.org/[musl libc], so they work on every Linux system (distro) regardless of used libc.

=== From Source Tarball

[source, sh, subs="+attributes"]
----
wget https://github.com/{gh-name}/archive/v{version}/{proj-name}-{version}.tar.gz
tar -xzf {proj-name}-{version}.tar.gz
cd {proj-name}-{version}

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

== Credits

This program is inspired from https://github.com/yetamrra/termcopy[termcopy] and https://github.com/ojroques/vim-oscyank[vim-oscyank].

== License

This project is licensed under http://opensource.org/licenses/MIT/[MIT License].
For the full text of the license, see the link:LICENSE[LICENSE] file.