A kitty clipboard write that asks first is answered done before the user answers #31

Closed
opened 2026-10-16 15:11:39 -05:00 by jeff · 1 comment
Owner

With clipboard.write = .ask, a kitty clipboard write (OSC 5522) is answered "done" as soon as it commits, before the user has answered the Confirmation. Session.clipboardWrite replies success and only then raises the write for the window to ask about. A write the user refuses has already been reported to the program as a success.

Found while working out #23. It isn't caused by multiple Clipboard types.

The protocol has EPERM for a refused write. Answering it needs the write's reply to be deferred until the Confirmation is answered, as reads already are. The Ghostty fork's write path has no deferral today, so this likely needs a fork change like the one reads got (ADR 0005).

With `clipboard.write = .ask`, a kitty clipboard write (OSC 5522) is answered "done" as soon as it commits, before the user has answered the Confirmation. `Session.clipboardWrite` replies success and only then raises the write for the window to ask about. A write the user refuses has already been reported to the program as a success. Found while working out #23. It isn't caused by multiple Clipboard types. The protocol has EPERM for a refused write. Answering it needs the write's reply to be deferred until the Confirmation is answered, as reads already are. The Ghostty fork's write path has no deferral today, so this likely needs a fork change like the one reads got (ADR 0005).
jeff closed this issue 2026-10-16 21:56:20 -05:00
Author
Owner

Fixed in 4bed3a9, on Ghostty fork commit 0afdd944b (clipboard.Write.deferReply and Handler.replyClipboardWrite). A kitty write now hears DONE once it is on the clipboard, and EPERM when .deny or the user refuses it (.deny also used to be answered DONE). It hears ENOSYS when the platform can't hold it, and EIO when putting it there fails. A write that is replaced before it's taken, or whose confirmation is replaced, gets EPERM. The sway VM test checks that nothing arrives before the user answers, then DONE for an allowed write and EPERM for a refused one.

Fixed in 4bed3a9, on Ghostty fork commit 0afdd944b (`clipboard.Write.deferReply` and `Handler.replyClipboardWrite`). A kitty write now hears DONE once it is on the clipboard, and EPERM when `.deny` or the user refuses it (`.deny` also used to be answered DONE). It hears ENOSYS when the platform can't hold it, and EIO when putting it there fails. A write that is replaced before it's taken, or whose confirmation is replaced, gets EPERM. The sway VM test checks that nothing arrives before the user answers, then DONE for an allowed write and EPERM for a refused one.
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#31
No description provided.