Expand description
Clipboard and selection access through OSC 52.
§Category
OSC 52 sets, requests, or clears named clipboards/selections. This module
provides the common system clipboard (c) and primary selection (p) selector
bytes plus writers for each operation.
§OSC framing
The emitted sequences use 7-bit OSC with BEL termination:
ESC ] 52 ; c ; aGk= BEL
──┬── ┬─ ┬ ─┬─ ─┬─
OSC code Pc base64 terminatorClipboard data is base64-encoded by write_set_clipboard. Request and
clear operations use ? or an empty payload in the same field.
§Mode interaction
OSC 52 is not gated by an ANSI/DEC mode. Terminals may still reject clipboard access by policy; this module only encodes the request bytes.
Constants§
- PRIMARY_
CLIPBOARD - OSC 52 selector byte
pfor the primary selection. - SYSTEM_
CLIPBOARD - OSC 52 selector byte
cfor the system clipboard.
Functions§
- write_
clear_ clipboard - Clear a clipboard or selection with
ESC ] 52 ; <pc> ; BEL. - write_
request_ clipboard - Request clipboard contents with
ESC ] 52 ; <pc> ; ? BEL. - write_
set_ clipboard - Set a clipboard or selection with
ESC ] 52 ; <pc> ; <base64-data> BEL.