GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): support middle-click paste from X11 primary selection by linuxhd0 · Pull Request #16379 · anomalyco/opencode

Conversation

@linuxhd0

@linuxhd0 linuxhd0 commented Mar 6, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #8915

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

It allows someone on Linux (Xorg, Wayland) to select text in one application and use the middle mouse button to paste into the prompt textbox without have to do ctrl-c + ctrl-v. This is common behaviour on Linux systems.

How did you verify your code works?

I ran bun dev after making the changes, selected some text in another terminal and pasted it into opencode and it worked. Without the fix, you don't get anything indication that anything at all happened in opencode.

I use Xorg, didn't try Wayland though.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

  1. PR fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste #6370: "fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste"

    • fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste #6370
    • Reason: Directly addresses the same Linux middle-click paste functionality with X11/Wayland support
  2. PR feat(opencode): add linux clipboard toast warnings  #10332: "feat(opencode): add linux clipboard toast warnings"

    • feat(opencode): add linux clipboard toast warnings  #10332
    • Reason: Related to Linux clipboard handling and may have overlapping implementation

These PRs appear to be addressing the same or very similar issue regarding middle-click paste support on Linux systems.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@linuxhd0

linuxhd0 commented Mar 7, 2026

Copy link
Copy Markdown
Author

All three open PRs touch Linux clipboard/middle-click paste but they're not really duplicates — each addresses a diiferent issue with pasting.

Summary Table

PR Title Problem Approach Files
#16379 fix(tui): support middle-click paste from X11 primary selection Middle-clicking into opencode's prompt does nothing On MouseButton.MIDDLE, call new Clipboard.readPrimary() and insert text clipboard.ts, prompt/index.tsx
#6370 fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste Text copied from opencode doesn't populate the primary selection, so other apps can't middle-click paste it On copy, optionally also write to the primary clipboard via --primary flag; opt-in via clipboard.linux.enablePrimaryCopy config clipboard.ts, config.ts
#10332 feat(opencode): add linux clipboard toast warnings Clipboard operations silently fail when wl-copy/xclip/xsel are not installed Return a CopyResult with a notice/warning and show toasts in the TUI clipboard.ts, multiple TUI call sites

Why They Are Complementary

  • fix(tui): support middle-click paste from X11 primary selection #16379 fixes the read/paste direction: opencode reads the primary selection on middle-click so users can paste text selected in another app.
  • fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste #6370 fixes the write/copy direction: opencode writes to the primary selection on copy so other apps can middle-click paste content from opencode.
  • feat(opencode): add linux clipboard toast warnings  #10332 is orthogonal: it improves feedback when clipboard tools are missing, regardless of which direction data is flowing.

As of today, all three can be merged independently and without conflict.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

inakineitor pushed a commit to inakineitor/ai-tui that referenced this pull request Mar 10, 2026
@claude
feat(clipboard): add middle-click paste from X11 primary selection
3b4611c
Adds readPrimary() function supporting wl-paste, xclip, and xsel
for reading the X11 primary selection buffer. Adds middle-click
handler to the prompt textarea.

Upstream: anomalyco/opencode#16379

https://claude.ai/code/session_01R2NB6YZNAFe57T3uhSCGo9
inakineitor pushed a commit to inakineitor/ai-tui that referenced this pull request Mar 10, 2026
@claude
feat(clipboard): add middle-click paste from X11 primary selection
5db9d49
Adds readPrimary() function supporting wl-paste, xclip, and xsel
for reading the X11 primary selection buffer. Adds middle-click
handler to the prompt textarea.

Upstream: anomalyco/opencode#16379

https://claude.ai/code/session_01R2NB6YZNAFe57T3uhSCGo9
This was referenced Mar 12, 2026
fix(opencode): improve linux clipboard error handling and add nix dependencies #17258
Closed
feat(tui): add double/triple click copy selection #17465
Closed
@linuxhd0
linuxhd0 force-pushed the fix/middle-click-paste branch from 9b20581 to f550caa Compare March 24, 2026 21:54
@opencode-agent
opencode-agent Bot force-pushed the dev branch from f9e35a3 to 1398674 Compare March 24, 2026 22:07
@opencode-agent
opencode-agent Bot requested a review from adamdotdevin as a code owner March 24, 2026 22:07
@linuxhd0
linuxhd0 force-pushed the fix/middle-click-paste branch from f550caa to aed4247 Compare April 3, 2026 21:43
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
linuxhd0 added 3 commits April 16, 2026 20:27
@linuxhd0
fix(tui): support middle-click paste from X11 primary selection
28f0d3f
@linuxhd0
fix(tui): import $ from bun in clipboard
51eae84
@linuxhd0
fix(tui): update clipboard and paste handling for opentui 0.1.88
a2eaa61
@linuxhd0
linuxhd0 force-pushed the fix/middle-click-paste branch from aed4247 to a2eaa61 Compare April 17, 2026 00:35
@rekram1-node

rekram1-node commented May 15, 2026

Copy link
Copy Markdown
Member

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node rekram1-node closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adamdotdevin adamdotdevin Awaiting requested review from adamdotdevin

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

On konsole, middle button press does not paste

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@linuxhd0 @rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.