Skip to content

Commit 749f151

Browse files
committed
docs/vt: add OSC 52
1 parent 74657fe commit 749f151

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

docs/nav.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@
500500
"path": "/22",
501501
"title": "Change Pointer Shape (OSC 22)"
502502
},
503+
{
504+
"type": "link",
505+
"path": "/52",
506+
"title": "Query or Change Clipboard Data (OSC 52)"
507+
},
503508
{
504509
"type": "link",
505510
"path": "/104",

docs/vt/osc/52.mdx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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.

docs/vt/reference.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ introduce better organization and search capabilities.
7979
| [OSC 19][OSC 1x] | `OSC 19 ; Pc ST` | Query or change the highlight foreground color |
8080
| [OSC 21] | `OSC 21 ; Pk = Pv ; ... ST ` | Query or change any color using the Kitty Color Protocol |
8181
| [OSC 22] | `OSC 22 ; Pt ST ` | Change the pointer shape |
82+
| [OSC 52] | `OSC 52 ; Pc ; Pd ST ` | Query or change clipboard data |
8283
| [OSC 104] | `OSC 104 ; Pn ST` | Reset palette colors |
8384
| [OSC 105] | `OSC 105 ; Pn ST` | Reset special colors |
8485
| [OSC 110][OSC 11x] | `OSC 110 ST` | Reset the foreground color |
@@ -104,6 +105,7 @@ introduce better organization and search capabilities.
104105
[OSC 1x]: /docs/vt/osc/1x
105106
[OSC 21]: https://sw.kovidgoyal.net/kitty/color-stack/
106107
[OSC 22]: /docs/vt/osc/22
108+
[OSC 52]: /docs/vt/osc/52
107109
[OSC 104]: /docs/vt/osc/104
108110
[OSC 105]: /docs/vt/osc/105
109111
[OSC 11x]: /docs/vt/osc/11x

0 commit comments

Comments
 (0)