Skip to content

TUI: Copy via Selection no longer works #17796

Closed as duplicate
Closed as duplicate

Description

@Laurenz-Ruzicka

Description

In the past it worked to select a piece of text to copy it into the clipboard. It still shows the message that the text was copied, but it never actually gets copied into the clipboard. I noticed this first around 1-2 weeks ago and hoped it would get fixed, but it didn't

Plugins

None

OpenCode version

1.2.27

Steps to reproduce

Try to copy text by selecting text in the TUI

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

Bash (Ubuntu default)

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Mar 16, 2026
  2. github-actions commented on Mar 16, 2026

    @github-actions
    Contributor

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

    If your issue is the same as one of the above, please comment there instead so efforts can be consolidated.

  3. tlerbao commented on Mar 16, 2026

    @tlerbao

    After selecting, my version no longer automatically copies, which I really like. The automatic deselection and copy function was so annoying.
    Because after selecting text, I might not want to copy it but rather use shortcuts for tasks like translation.
    But now, after selecting text, I can only copy using the right mouse button, and can't use command+c, which is also very annoying.

  4. AbigailJixiangyuyu commented on Mar 16, 2026

    @AbigailJixiangyuyu
    Contributor

    Hi, thanks for the report. Linux copy can depend on tools like wl-copy, xclip, or xsel, and the app may currently show the success toast even when the underlying clipboard backend fails.
    Could you help check your environment and share the results?

    Are any clipboard tools available?
    command -v wl-copy
    command -v wl-paste
    command -v xclip
    command -v xsel

  5. tlerbao commented on Mar 16, 2026

    @tlerbao
    Image

    No output

  6. AbigailJixiangyuyu commented on Mar 16, 2026

    @AbigailJixiangyuyu
    Contributor
    Image No output

    Are you running this inside a Linux desktop session (GUI), or in a non-graphical environment such as SSH/TTY/headless server?

  7. AbigailJixiangyuyu commented on Mar 16, 2026

    @AbigailJixiangyuyu
    Contributor

    It looks like your environment may be missing a clipboard tool that opencode can use on Linux.
    Could you first confirm which desktop session you're running?
    echo $XDG_SESSION_TYPE
    Then install the matching clipboard tool:

    • If it prints x11:
      sudo apt install xclip
    • If it prints wayland:
      sudo apt install wl-clipboard
      After installing, please restart the terminal and try again.
      This should resolve the issue in most cases, since on Linux the TUI copy flow depends on an available clipboard backend such as xclip or wl-copy.
  8. tlerbao commented on Mar 16, 2026

    @tlerbao

    @AbigailJixiangyuyu I am macOS 13,

  9. xmready commented on Mar 16, 2026

    @xmready

    #17858

    @AbigailJixiangyuyu I don't understand why gnome-terminal can copy and paste text without wl-clipboard in wayland but opencode cannot. Isn't there a more native way to support it without additional packages?

  10. AbigailJixiangyuyu commented on Mar 17, 2026

    @AbigailJixiangyuyu
    Contributor

    @AbigailJixiangyuyu I am macOS 13,

    On macOS this likely is not a missing dependency issue.
    The current TUI clipboard path uses osascript, and it looks like failures from that command may currently be treated as success, which would explain why the UI shows Copied to clipboard even when the clipboard does not actually change.
    Sorry, I do not have a macOS environment available, so I cannot help investigate this any further from my side.

  11. AbigailJixiangyuyu commented on Mar 17, 2026

    @AbigailJixiangyuyu
    Contributor

    #17858

    @AbigailJixiangyuyu I don't understand why gnome-terminal can copy and paste text without wl-clipboard in wayland but opencode cannot. Isn't there a more native way to support it without additional packages?

    I guess the reason is that gnome-terminal can copy because it is the terminal emulator itself and has direct access to the desktop clipboard. However, opencode runs as a child process inside the terminal, so it does not automatically get the same access. What's more, the code already tries the terminal-native route via OSC 52, then falls back to wl-copy / xclip / xsel.

  12. xmready commented on Mar 18, 2026

    @xmready

    I guess the reason is that gnome-terminal can copy because it is the terminal emulator itself and has direct access to the desktop clipboard. However, opencode runs as a child process inside the terminal, so it does not automatically get the same access. What's more, the code already tries the terminal-native route via OSC 52, then falls back to wl-copy / xclip / xsel.

    @AbigailJixiangyuyu are you saying there's no way to use the terminal-native route because opencode runs as a child process? Are you saying that wl-copy is the only way to get this working in this case? Thanks.

  13. wigy-opensource-developer commented on Mar 19, 2026

    @wigy-opensource-developer

    The underlying issue is that there is no error message like "Hey, I wanted to copy to clipboard, but you are missing some system package for it. I wanted to use xclip, this is how you install it."

  14. removed
    bugSomething isn't working
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 3, 2026
  15. aceroraas commented on May 4, 2026

    @aceroraas

    Environment:

    • Distribution: Debian GNU/Linux 13 (trixie)
    • Desktop Environment: GNOME (Wayland session)
    • Display Server: wayland-0
    • Terminal: GNOME Terminal server (gnome-terminal-server) embedded in Electron app
    • OpenCode Version: 1.14.33

    Bug Description:
    Copy via text selection shows "copied to clipboard" notification but the content is not available when pasting. Neither Ctrl+Shift+V nor middle-click (mouse scroll wheel) paste work. The clipboard appears to be completely non-functional on Wayland.

    What doesn't work:

    • Ctrl+Shift+C / Ctrl+Shift+V — shows "copied" but content unavailable
    • Middle-click paste — does not paste anything
    • Copy/paste between opencode and external applications

    Additional context:
    This is a complete clipboard failure, not just a cross-session issue. Regression on Wayland. Multiple related issues filed (#17796, #17858, #13984). Electron + Wayland + GNOME known to have clipboard problems.

  16. emsi commented on May 8, 2026

    @emsi

    No properly behaving terminal application depends on external tools for text selection and copy. On X11 no-one even needs to "copy" as selected text is immediately available for being pasted. opencode is completely broken, does not work over remote session, inside container etc. It generally is misbehaving application that damages your terminal and should be avoided.

  17. GollyTicker commented on May 27, 2026

    @GollyTicker

    This workaround worked for me! #17796 (comment)

  18. mkdgs commented on Jul 19, 2026

    @mkdgs

    This workaround is also working for me.
    An alternative without restarting the terminal, you can press Shift before clicking to disable auto-copy.

  19. toxmc commented on Aug 6, 2026

    @toxmc

    term off tui mouse and reopen opencode use ctrl+c ok

    Image
  20. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    Closing as a duplicate of #4283, which tracks copy to clipboard not working in the TUI (it shows "copied", but nothing reaches the clipboard). Please add your OS, terminal and OpenCode version there.

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