terminal: exempt Kitty clipboard listing reads from permission prompts

A Kitty clipboard protocol (OSC 5522) read that only requests the
targets type ('.') is now served without a permission prompt and never
consults (or consumes) session password grants. 

The spec requires this so that a client listing the available data types 
before reading one doesn't present the user with a double permission prompt.
This commit is contained in:
Mitchell Hashimoto
2026-08-24 13:24:34 -07:00
parent 89d17b378e
commit 928c7f0e79
7 changed files with 114 additions and 13 deletions

View File

@@ -757,6 +757,11 @@ struct GhosttyClipboardRead {
* True if the terminal already holds a session grant for this request
* (kitty clipboard protocol passwords). The embedder should skip any
* permission prompt and serve the read.
*
* Always false when mimes_len is zero: such a request is served
* without a prompt (see the callback docs), so the terminal never
* consults grants for it and a one-time password is preserved for
* the follow-up data read.
*/
bool granted;
@@ -792,7 +797,9 @@ struct GhosttyClipboardRead {
* state; a reply that sets `remember` records a session grant so later
* requests with the same password arrive with `granted` set. Kitty itself
* serves a request for only the targets listing (`list` with no `mimes`)
* without prompting.
* without prompting, and embedders are expected to do the same; the
* terminal never consults grants for such requests (`granted` is false
* and one-time passwords are not consumed).
*
* Installing this callback also enables Kitty paste events (mode 5522):
* ghostty_terminal_paste() sends the program an event instead of the text,