wire / terminal-osc / 52
OSC 52 ; Pc ; Pd ST manipulates the system clipboard. Pc selects which clipboard ('c' = CLIPBOARD, 'p' = PRIMARY, etc.); Pd is the base64-encoded data to set, or '?' to query (the terminal replies with the clipboard contents, base64-encoded). Lets a program running anywhere — including over ssh — copy to the local clipboard.
aka: clipboard · set clipboard · query clipboard · OSC 52 · ESC ] 52 · copy over ssh
OSC introducer: \x1b] ESC ] (0x1B 0x5D)
terminator (ST|BEL): ST \x1b\ · BEL \x07
| id | name | bytes (ST) | meaning |
|---|---|---|---|
| set | Set clipboard | \x1b]52;c;aGVsbG8=\x1b\ | OSC 52 ; Pc ; <base64> ST sets clipboard Pc to the base64-decoded bytes. Pc: 'c' = CLIPBOARD, 'p' = PRIMARY, 'q' = secondary, 's' = select, '0'-'7' = cut-buffers; empty Pc defaults to CLIPBOARD+PRIMARY. The data field is standard base64 of the raw clipboard bytes. |
| query | Query clipboard | \x1b]52;c;?\x1b\ | OSC 52 ; Pc ; ? ST asks the terminal to report the current contents of clipboard Pc. The terminal replies with OSC 52 ; Pc ; <base64> ST containing the base64-encoded clipboard data (if querying is enabled). |
per-fact attribution:
agent: curl -H 'accept: application/json' wire.phall.io/terminal-osc/52
or /terminal-osc/52.json