Skip to content

Latest commit

 

History

History
79 lines (49 loc) · 2.47 KB

tty-copy.1.adoc

File metadata and controls

79 lines (49 loc) · 2.47 KB

tty-copy(1) Manual Page

NAME

tty-copy - copy content to the system clipboard via TTY

SYNOPSIS

tty-copy [options] [<text…​>]

DESCRIPTION

tty-copy copies the given text to the controlling TTY using OSC 52 escape sequence and base64 encoding. If no text is given, tty-copy copies data from its standard input.

This allows terminals that support OSC 52 to copy the data into the system clipboard. It works in any terminal session, whether local, remote, or even nested therein! The supporting terminal must obviously (a) support OSC 52 and (b) have permission to access the clipboard.

The maximum length of an OSC 52 escape sequence is originally 100 000 bytes in total which means 74 994 bytes of plain text. However, some terminal emulators have higher limit; for example, kitty allows up to 8 MiB by default.

For the specification see the section Operating System Controls, code 52, Manipulate Selection Data, in Xterm Control Sequences (https://www.xfree86.org/current/ctlseqs.html).

OPTIONS

-c, --clear

Instead of copying anything, clear the clipboard so that nothing is copied.

-n, --trim-newline

Do not copy the trailing newline character.

-o <file>, --output <file>

Path of the terminal device (defaults to /dev/tty).

-p, --primary

Use the “primary” clipboard (selection) instead of the regular clipboard.

-T <type>, --term <type>

Specify the type of the terminal. Currently, only "screen" and "tmux" are recognized, any other value is interpreted as the default.

If not specified, "screen" and "tmux" are autodetected based on the TERM and TMUX environment variables.

-t, --test

Test whether your terminal processes the OSC 52 escape sequence — if it does, exits with status code 0, otherwise with 1.

The fact that the terminal processes the sequence does not necessarily mean that access to the system clipboard will work — it may be disabled. This option only tests if the sequence is intercepted by the terminal or visibly printed on the screen.

-V, --version

Display the version of tty-copy and exit.

-h, --help

Display the help message and exit.

EXIT CODES

  • 0 — Clean exit, no error has encountered.

  • 1 — General error.

  • 10 — Invalid usage.

  • 11 — I/O error.

AUTHORS

Jakub Jirutka

REPORTING BUGS

Report bugs to the project’s issue tracker at https://github.com/jirutka/tty-copy/issues.