Kitty's clipboard protocol (mode 5522) #18

Closed
opened 2026-10-14 20:00:57 -05:00 by jeff · 1 comment
Owner

Kitty's clipboard protocol, mode 5522: with it on, a paste goes to the program as a kitty paste event rather than as bracketed text. Ghostty's terminal code, which harrier uses, supports it once a kitty_clipboard context exists, and that is set up only when clipboard reading is (stream_terminal.zig). harrier leaves it unset.

Left out of the clipboard-access confirmation work on purpose. Once programs can read the clipboard behind a confirmation, decide whether to turn this on, and how its reads go through the same confirmation and settings (clipboard.read, a profile's clipboard_read).

Kitty's clipboard protocol, mode 5522: with it on, a paste goes to the program as a kitty paste event rather than as bracketed text. Ghostty's terminal code, which harrier uses, supports it once a `kitty_clipboard` context exists, and that is set up only when clipboard reading is (stream_terminal.zig). harrier leaves it unset. Left out of the clipboard-access confirmation work on purpose. Once programs can read the clipboard behind a confirmation, decide whether to turn this on, and how its reads go through the same confirmation and settings (`clipboard.read`, a profile's `clipboard_read`).
jeff closed this issue 2026-10-15 21:59:27 -05:00
Author
Owner

Done in e262024, released in v0.4.0.

harrier now serves kitty's clipboard protocol reads (OSC 5522) and turns on its paste events (mode 5522). libghostty-vt could only answer an OSC 5522 read synchronously, inside the callback on the IO thread. The fork's zig-0.17-jeff branch now lets those replies be deferred, as OSC 52 ones already could (c7e327c4). So the reads take the same path as OSC 52:

  • They are asked about, allowed or refused as clipboard.read, or a profile's clipboard_read, says. "Allow for this pane" covers both protocols.
  • As in kitty, a read for only the list of types is not asked about, though .deny still refuses it.
  • A program fetching what the user just pasted, after a paste event, is neither asked nor refused: the user already pasted it.
  • A paste into a program with paste events on skips the unsafe-paste question, since nothing of it runs as it arrives.
  • Only text is handed over, under each text type the program asks for. Other types are #23.

The sway VM test covers a listing, an allowed read, and a paste event fetched with its one-time password.

Fixing the VM test also turned up a crash, fixed in d66db83: any confirmation drawn in a pane 64 cells wide or more overflowed a u7 and panicked.

Done in e262024, released in v0.4.0. harrier now serves kitty's clipboard protocol reads (OSC 5522) and turns on its paste events (mode 5522). libghostty-vt could only answer an OSC 5522 read synchronously, inside the callback on the IO thread. The fork's `zig-0.17-jeff` branch now lets those replies be deferred, as OSC 52 ones already could (c7e327c4). So the reads take the same path as OSC 52: - They are asked about, allowed or refused as `clipboard.read`, or a profile's `clipboard_read`, says. "Allow for this pane" covers both protocols. - As in kitty, a read for only the list of types is not asked about, though `.deny` still refuses it. - A program fetching what the user just pasted, after a paste event, is neither asked nor refused: the user already pasted it. - A paste into a program with paste events on skips the unsafe-paste question, since nothing of it runs as it arrives. - Only text is handed over, under each text type the program asks for. Other types are #23. The sway VM test covers a listing, an allowed read, and a paste event fetched with its one-time password. Fixing the VM test also turned up a crash, fixed in d66db83: any confirmation drawn in a pane 64 cells wide or more overflowed a `u7` and panicked.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jeff/harrier#18
No description provided.