fix(cli) Linux clipboard selection#32370
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate PRs Found
Note: PR #6370 appears to be the most relevant, as it specifically addresses enabling PRIMARY clipboard copy for Linux middle-click paste functionality—the exact feature being implemented in PR #32370. |
I reviewed the potential duplicates flagged by the bot, and here is how this PR compares: PR #31252 and PR #27861 are not duplicates. They handle clipboard failure reporting and error validation rather than the primary selection buffer. PR #6370 attempts to solve the same underlying issue (adding PRIMARY selection for Linux middle-click paste), but there are a few key differences. First, that PR has been stalled since December. Second, my implementation introduces a more flexible configuration approach—letting the user explicitly choose between Clipboard, Primary, or Both (defaulting to Both)—whereas #6370 uses a simple boolean toggle. Finally, this PR optimizes the copy operation under the hood by utilizing Promise.allSettled to update the buffers in parallel. Given these architectural differences and the inactivity on #6370, I believe this PR provides a more robust and complete solution to closing #29963. Let me know if any changes are needed! |
b1cb38a to
c6e0c83
Compare
Linux clipboard selection support (fixes #29963)
Issue for this PR
Closes #29963
Type of change
What does this PR do?
When I select text in Linux terminal it is expected that it's copied to PRIMARY buffer and I can paste it with a mouse middle button click. Opencode only copies to Clipboard (pasted with Ctrl-V).
Added a config option to selected between Clipboard / Primary / Both (default) and added additional calls to
xclipand others.I implemented Promise.allSettled to update both buffers in parallel
How did you verify your code works?
I select text and selection goes to the configured destination - Clipboard / Primary / Both (default)
Screenshots / recordings
there's no way to record a video that would show difference between pasting via Ctrl-V and middle button click
Checklist
If you do not follow this template your PR will be automatically rejected.