Terminal Guide

Set/Get Clipboard Contents

ESC1B ]5D 5235 32 ;3b kinds ;3b data ESC1B \5C
xterm
🔧
kinds = s0

Set/Get Clipboard Contents.

This sequence is disabled in many default configurations, because it can be dangerous.

If data is '?' gets the current clipboard contents. Otherwise data must contain the contents to be set in base64 encoding.

The kinds parameter selects which clipboards to act on. Each character designates one clipboard to act on. When reading from the clipboard the first clipboard which contains data is used. When writing to the clipboard all clipboards in kinds are written to.

The characters in kinds have the following meanings (these are X11 clipboard types except for 's'):

s: configured default clipboard
p: Primary
q: Secondary
c: Clipboard
0-7: Cut buffers

Reading from the clipboard results in a reply from the terminal of the form:

ESC1b ]5d 535 232 ;3b kind ;3b data ESC1b \5c 

Where kind is similar to the value in the request with all unsupported types removed. And data contains the data read from the clipboard in base64 encoding.