Repository navigation
macos: defer OSC52 clipboard read confirmations until focused - #13744
Merged
Merged
Conversation
bo2themax
approved these changes
Aug 11, 2026
bo2themax
left a comment
Member
There was a problem hiding this comment.
I'm thinking we can move the confirmation to an overlay of the surface, so we don't need to check them in the window controller. But I haven't tried it yet, will open a follow up pr if it works better.
bo2themax
requested changes
Aug 11, 2026
bo2themax
left a comment
Member
There was a problem hiding this comment.
I tried a script that repeated request clipboard write/read, it still steals focus from another tab
Screen.Recording.2026-08-11.at.2.31.49.PM.Fast.1080p30.mp4
Contributor
Author
|
Oh strange, I had a similar script and it did not. let me try again. |
Contributor
Author
|
Oh its because this only protected OSC52 read, but we should probably just do this for all clipboard ops that require confirmation. I started with OSC52 due to the linked discussion. |
Fixes #10077 Clipboard read confirmations would immediately show a sheet which grabbed focus. This could be used for a bunch of dumb reasons, including DoS attacks. But, it also caused focus/sheet loops for programs that did OSC52 on focus changes (which was seen via some Neovim configs!). Now, if a surface is unfocused, we bell the surface and show the confirmation request on next focus. If the surface is not focused or another request comes in, we cancel the prior one. This also fixes some memory management issues around clipboard requests that were likely small leaks (didn't verify the old bug, but verified the new code, and eyeballed the old).
Contributor
Author
|
Fixed, pushed. |
bo2themax
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10077
Clipboard read confirmations would immediately show a sheet which grabbed focus. This could be used for a bunch of dumb reasons, including DoS attacks. But, it also caused focus/sheet loops for programs that did OSC52 on focus changes (which was seen via some Neovim configs!).
Now, if a surface is unfocused, we bell the surface and show the confirmation request on next focus. If the surface is not focused or another request comes in, we cancel the prior one.
This also fixes some memory management issues around clipboard requests that were likely small leaks (didn't verify the old bug, but verified the new code, and eyeballed the old).
To implement this, I decided to reorient the whole clipboard confirmation thing around state on SurfaceView (which simplifies memory management) and using Combine on BaseTerminalController to get notified.