Skip to content

[FEATURE]: Add support for Linux PRIMARY selection (middle-click paste) #43176

Open

Description

@bornmw

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Description

Currently, the TUI only targets the CLIPBOARD selection when copying text. On Linux, this means that while Ctrl+C/V works, the native "highlight to copy" and "middle-click to paste" behavior (PRIMARY selection) is not supported.

This makes the TUI feel non-native on Linux environments.

Proposed Solution

Introduce a new configuration option linux_clipboard_selection in the TUI config with the following values:

  • clipboard: Standard Ctrl+C/V (current behavior)
  • primary: Targets the middle-click buffer
  • both: Updates both buffers simultaneously (recommended default)

This requires using xclip, xsel, or wl-copy to explicitly target the primary selection.


Copied from issue #29963

Activity

  1. github-actions commented on Aug 18, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If you reopened this because #29963 was closed without resolution, please consider commenting on the original issue to request it be reopened, or provide additional context here about why a new issue is warranted.

  2. bornmw commented on Aug 18, 2026

    @bornmw
    Author

    If you reopened this because #29963 was closed without resolution, please consider commenting on the original issue to request it be reopened, or provide additional context here about why a new issue is warranted.

    The original issue closure comment literally instructs to open new issue: "If the issue is still relevant please open a new one."

  3. kylebakerio commented on Aug 21, 2026

    @kylebakerio

    yes, copy and pasting out of opencode is wild. nothing else has this problem in linux and hijacks copy/pasting this way. I get the feeling that a windows user thought that highlight-to-copy was a cool idea, so they implemented it themselves from scratch. Which, it is a cool idea. but by doing their custom thing, they're overriding that we already have a way to do this in linux, and we use two clipboards, and they're completely breaking that functionality.

    likewise with pasting, I constantly have my flow broken trying to figure out how to paste in when I go to middle click paste and it doesn't work and then I have to figure out how to paste in to opencode.

    I honestly never realized ctrl+shift+v could paste into the terminal after all these years. I just was middle click pasting. I learned that feature just because of opencode.

    but that's still not a substitute for beaking the os. this feature is critical.

    luckily this looks likely to be merged: #32370

  4. bornmw commented on Sep 22, 2026

    @bornmw
    Author

    #32370 still not merged, but I've been running it locally for over a month now, it's amazing

  5. donbowman commented on Sep 23, 2026

    @donbowman
    Contributor

    I too am somewhat desperate to get #32370 merged, its so awful as it is.

  6. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for opening this again, @bornmw! The request: when you copy text in the TUI (including copy-on-select), it should also (or instead) go to the Linux PRIMARY selection so middle-click paste works. You suggest a linux_clipboard_selection option with clipboard, primary and both.

    Right now the TUI only reads from and writes to the CLIPBOARD selection (packages/tui/src/clipboard.ts), so this is new behaviour rather than a bug. Maintainers will consider it.

    Related issues:

  7. axeluhl commented on Oct 30, 2026

    @axeluhl

    yes, copy and pasting out of opencode is wild. nothing else has this problem in linux and hijacks copy/pasting this way

    Copilot's CLI has exactly the same issue on a GNOME terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions