|
| 1 | +--- |
| 2 | +title: Query or Change Clipboard Data (OSC 52) |
| 3 | +description: Query or change data on clipboards. |
| 4 | +--- |
| 5 | + |
| 6 | +<VTSequence sequence={["OSC", "52", ";", "Pt", ";", "Pd", "ST"]} /> |
| 7 | + |
| 8 | +Query or change data on clipboards specified by `t` based on the |
| 9 | +value of `d`. |
| 10 | + |
| 11 | +`t` is a list of **zero or more** characters that each correspond to |
| 12 | +a different type of clipboard on the system. The meaning of each character |
| 13 | +in `t` as defined by xterm is as follows: |
| 14 | + |
| 15 | +| `t` | Type | |
| 16 | +|---------|---------------------| |
| 17 | +| `c` | Standard clipboard | |
| 18 | +| `p` | Primary clipboard | |
| 19 | +| `q` | Secondary clipboard | |
| 20 | +| `s` | Selection clipboard | |
| 21 | +| `0`–`7` | Cut-buffer `0`–`7` | |
| 22 | + |
| 23 | +> [!NOTE] |
| 24 | +> Ghostty only recognizes `c`, `p`, and `s` as valid values in `t`. |
| 25 | +> Other types are treated as aliases for `c`. When `t` is omitted, |
| 26 | +> Ghostty defaults to querying or modifying the primary clipboard |
| 27 | +> (equivalent to `c`). |
| 28 | +
|
| 29 | +> [!WARNING] |
| 30 | +> Ghostty currently only allows specifying one clipboard per sequence. |
| 31 | +> This is a limitation on our end and may be fixed in the future. |
| 32 | +
|
| 33 | +When `d` is the single character `?`, the terminal will reply with |
| 34 | +another OSC 52 sequence with the data found from the first clipboard |
| 35 | +listed in `t` that contains the requested data. |
| 36 | + |
| 37 | +Otherwise, `d` is expected to be a Base64-encoded string that contains |
| 38 | +the new data for all clipboards listed in `t`. |
| 39 | + |
| 40 | +If `d` is neither a valid Base64-encoded string or the character `?`, |
| 41 | +all clipboards listed in `t` are cleared. |
0 commit comments