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 — Clipboard copy fails in web-based VSCode terminals (code-server, GitHub Codespaces) · Issue #26459 · anomalyco/opencode

Clipboard copy fails in web-based VSCode terminals (code-server, GitHub Codespaces) #26459

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
Clipboard copy fails in web-based VSCode terminals (code-server, GitHub Codespaces)#26459
Copy link
Assignees
kommander

Description

@xuxusheng
xuxusheng
opened on May 9, 2026
Issue body actions

Description

Clipboard copy functionality does not work when running OpenCode in web-based VSCode environments such as:

  • code-server (self-hosted VS Code in browser)
  • GitHub Codespaces
  • VS Code Remote SSH (in some configurations)
  • Gitpod

The UI shows "Copied to clipboard" notification, but nothing is actually copied to the clipboard.

Environment

  • OpenCode version: v1.14.41
  • VS Code environment: code-server / GitHub Codespaces
  • Terminal: VS Code integrated terminal (web-based)
  • OS: Linux (headless server, no X11/Wayland)
  • Browser: Chrome/Firefox/Edge

Steps to Reproduce

  1. Open a web-based VSCode environment (code-server, GitHub Codespaces, etc.)
  2. Install and run OpenCode in the integrated terminal
  3. Start a conversation and get a response
  4. Try to copy text using:
    • Mouse selection (auto-copy on select)
    • OpenCode's built-in copy command (y key)
    • Keyboard shortcuts (Ctrl+C/Cmd+C)
  5. Notification shows "Copied to clipboard"
  6. Try to paste in another application
  7. Result: Nothing is pasted (clipboard is empty)

Expected Behavior

Clipboard copy should work in web-based VSCode environments, allowing users to copy:

  • Code snippets from responses
  • File paths and URLs
  • Any text content from OpenCode

Actual Behavior

  • Copy notification appears ("Copied to clipboard")
  • Nothing is actually copied to clipboard
  • No way to copy content from OpenCode in web-based VSCode

Impact

This issue affects developers who use:

  • code-server: Self-hosted VS Code for remote development
  • GitHub Codespaces: Cloud-based development environments
  • Gitpod: Cloud development platforms
  • VS Code Remote SSH: Remote server development

These environments are increasingly popular for remote development, cloud-based workflows, and development on tablets/mobile devices.

Related Issues

  • #11909: OSC52 clipboard doesn't work with VS Code Remote SSH
  • #4283: Copy To Clipboard is not working
  • opencode lastest version not copy to clipbord #17483: opencode latest version not copy to clipboard
  • #8237: copying to clipboard doesn't work in a remote session
Reacted by Huy Huynh and naourass
Reacted by naourass

Activity

  1. github-actions
    assigned
    kommander
    on May 9, 2026
  2. github-actions commented on May 9, 2026

    @github-actions
    github-actionsBot
    on May 9, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • OSC52 clipboard doesn't work with VS Code Remote SSH - need fallback or detection #11909: OSC52 clipboard doesn't work with VS Code Remote SSH - covers the same environment detection problem and silent failure with the same root cause
    • copying to clipboard doesn't work in a remote session (like a devcontainer) #8237: Clipboard copy fails in devcontainer/remote sessions - same issue in VS Code-based remote environments

    Please review those issues to see if your report adds new information not already covered. If it does, please clarify what is different.

  3. samuel-stern-fhr commented on May 18, 2026

    @samuel-stern-fhr
    samuel-stern-fhr
    on May 18, 2026
    More actions

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

    • OSC52 clipboard doesn't work with VS Code Remote SSH - need fallback or detection #11909: OSC52 clipboard doesn't work with VS Code Remote SSH - covers the same environment detection problem and silent failure with the same root cause
    • copying to clipboard doesn't work in a remote session (like a devcontainer) #8237: Clipboard copy fails in devcontainer/remote sessions - same issue in VS Code-based remote environments

    Please review those issues to see if your report adds new information not already covered. If it does, please clarify what is different.

    This is the same issue, but it is unresolved.

  4. l-astslice commented on Jun 1, 2026

    @l-astslice
    l-astslice
    on Jun 1, 2026
    More actions

    /tui default fixes this instantly in claude code! which was my issue

    Reacted by Huy Huynh
  5. Animeshz commented on Jul 7, 2026

    @Animeshz
    Animeshz
    on Jul 7, 2026
    More actions

    As a workaround I patched the opencode with:

    diff --git a/packages/tui/src/app.tsx b/packages/tui/src/app.tsx
    index 1b9fad873..2e749c900 100644
    --- a/packages/tui/src/app.tsx
    +++ b/packages/tui/src/app.tsx
    @@ -134,6 +134,7 @@ const appBindingCommands = [
       "app.toggle.diffwrap",
       "app.toggle.paste_summary",
       "app.toggle.session_directory_filter",
    +  "app.toggle.mouse",
     ] as const
     
     export type TuiInput = {
    @@ -940,6 +941,19 @@ function App(props: { onSnapshot?: () => Promise<string[]>; pluginHost: TuiPlugi
               dialog.clear()
             },
           },
    +      {
    +        name: "app.toggle.mouse",
    +        title: renderer.useMouse ? "Disable mouse mode (enable Cmd+C)" : "Enable mouse mode (enable scrolling)",
    +        category: "System",
    +        run: () => {
    +          renderer.useMouse = !renderer.useMouse
    +          dialog.clear()
    +          toast.show({
    +            message: renderer.useMouse ? "Mouse mode enabled" : "Mouse mode disabled — Cmd+C copy should work",
    +            variant: "info",
    +          })
    +        },
    +      },
           {
             name: "permission.mode",
             title:
    diff --git a/packages/tui/src/config/keybind.ts b/packages/tui/src/config/keybind.ts
    index 5dd7e4b5a..f2a70c862 100644
    --- a/packages/tui/src/config/keybind.ts
    +++ b/packages/tui/src/config/keybind.ts
    @@ -54,6 +54,7 @@ export const Definitions = {
       app_toggle_diffwrap: keybind("none", "Toggle diff wrapping"),
       app_toggle_paste_summary: keybind("none", "Toggle paste summary"),
       app_toggle_session_directory_filter: keybind("none", "Toggle session directory filtering"),
    +  app_toggle_mouse: keybind("ctrl+o", "Toggle mouse mode (on/off) for copy support"),
       command_list: keybind("ctrl+p", "List available commands"),
       help_show: keybind("none", "Open help dialog"),
       docs_open: keybind("none", "Open documentation"),
    @@ -263,6 +264,7 @@ export const CommandMap = {
       app_toggle_diffwrap: "app.toggle.diffwrap",
       app_toggle_paste_summary: "app.toggle.paste_summary",
       app_toggle_session_directory_filter: "app.toggle.session_directory_filter",
    +  app_toggle_mouse: "app.toggle.mouse",
       command_list: "command.palette.show",
       help_show: "help.show",
       docs_open: "docs.open",

    ctrl+o stops all event captures - scroll will stop working too - but the selection & copy works just like it'd work in a normal terminal (Cmd+c). Then when copy is done, you can toggle the mouse & keyboard events back on by ctrl+o.

  6. GHuyHuynh commented on Jul 19, 2026

    @GHuyHuynh
    GHuyHuynh
    on Jul 19, 2026
    More actions

    Running into the same issue with pasting from clipboard. I suspect this related to opentui and the kitty keybinding not working with browser base terminals. Hope this get fix soon

  7. Yakrel commented on Jul 21, 2026

    @Yakrel
    Yakrel
    on Jul 21, 2026
    More actions

    **Workaround for code-server / web-based VS Code terminals:

    Setting OPENCODE_DISABLE_MOUSE=true as an environment variable disables opencode TUI mouse capture, allowing the browser native text selection and copy (Ctrl+C) to work normally in code-server terminals.

    Add to ~/.bashrc:

    export OPENCODE_DISABLE_MOUSE=true

    Why this works: opencode TUI intercepts all mouse events and attempts clipboard writes via OSC52 then xclip/xsel, which silently fail in headless web-based VS Code environments (no X11/Wayland, and VS Code does not forward OSC52). By disabling mouse capture, the browser handles text selection and clipboard natively, bypassing opencode broken clipboard chain entirely.

    Tested on:

    • code-server v4.x + opencode v1.18.4
    • Headless Debian 13 (no X11/Wayland)
    • Cloudflare Tunnel access

    Caveat: keyboard-only TUI navigation (arrow keys, tab, enter) - no mouse scrolling or clicking on UI elements. Practically fine for most workflows since keyboard shortcuts (Ctrl+X Y etc.) still work.

    Reacted by Huy Huynh and Mew 3.0
  8. GHuyHuynh commented on Jul 22, 2026

    @GHuyHuynh
    GHuyHuynh
    on Jul 22, 2026
    More actions

    Thanks for the workaround @Yakrel . Hopefully Opencode fix this soon so we can use OC on web-based terminals

    Reacted by Berkay YETGİN and John Happy
  9. GHuyHuynh commented on Aug 9, 2026

    @GHuyHuynh
    GHuyHuynh
    on Aug 9, 2026
    More actions

    Update on this issue.

    VSCode Feb 2026 Release add Kitty protocol into VSCode. And this is enable by default which caused VSCode terminal to conflict with OpenCode on Browser-based version.

    Look at this VSCode discussion to see on how to disable Kitty protocol.

    All clipboard pasting keybind now work in OC after disabling the VSCode setting. Hope it solve the issue.

    Reacted by John Happy
  10. Lvshujun0918 commented on Aug 29, 2026

    @Lvshujun0918
    Lvshujun0918
    on Aug 29, 2026
    More actions

    Update on this issue.

    VSCode Feb 2026 Release add Kitty protocol into VSCode. And this is enable by default which caused VSCode terminal to conflict with OpenCode on Browser-based version.

    Look at this VSCode discussion to see on how to disable Kitty protocol.

    All clipboard pasting keybind now work in OC after disabling the VSCode setting. Hope it solve the issue.

    Sorry, but may you offer the detail instructions. In that discussion, they mentioned a lot about "kitty keyboard". But I cannot find it in the code-server preference. @GHuyHuynh

  11. Lvshujun0918 commented on Aug 29, 2026

    @Lvshujun0918
    Lvshujun0918
    on Aug 29, 2026
    More actions

    **Workaround for code-server / web-based VS Code terminals:

    Setting OPENCODE_DISABLE_MOUSE=true as an environment variable disables opencode TUI mouse capture, allowing the browser native text selection and copy (Ctrl+C) to work normally in code-server terminals.

    Add to ~/.bashrc:

    export OPENCODE_DISABLE_MOUSE=true
    Why this works: opencode TUI intercepts all mouse events and attempts clipboard writes via OSC52 then xclip/xsel, which silently fail in headless web-based VS Code environments (no X11/Wayland, and VS Code does not forward OSC52). By disabling mouse capture, the browser handles text selection and clipboard natively, bypassing opencode broken clipboard chain entirely.

    Tested on:

    • code-server v4.x + opencode v1.18.4
    • Headless Debian 13 (no X11/Wayland)
    • Cloudflare Tunnel access

    Caveat: keyboard-only TUI navigation (arrow keys, tab, enter) - no mouse scrolling or clicking on UI elements. Practically fine for most workflows since keyboard shortcuts (Ctrl+X Y etc.) still work.

    It does work, thx. But I wonder how to scroll the session content.

  12. GHuyHuynh commented on Sep 1, 2026

    @GHuyHuynh
    GHuyHuynh
    on Sep 1, 2026
    More actions

    @Lvshujun0918 , yeah Copy is still an issue on browser-base code-server VScode. Hoping OC have a workaround soon.

  13. Lvshujun0918 commented on Sep 1, 2026

    @Lvshujun0918
    Lvshujun0918
    on Sep 1, 2026
    More actions

    @Lvshujun0918 , yeah Copy is still an issue on browser-base code-server VScode. Hoping OC have a workaround soon.

    Well, still thanks for your tips. Hope it will be fixed soon.

  14. bilogic commented on Sep 9, 2026

    @bilogic
    bilogic
    on Sep 9, 2026
    More actions

    can we make this work? would be so much better if we do not have to resort to OPENCODE_DISABLE_MOUSE=true

    Reacted by Christoph Raab
  15. disarticulate commented on Sep 12, 2026

    @disarticulate
    disarticulate
    on Sep 12, 2026
    More actions

    copy paste doesnt work anywhere because who ever decided to override normal terminal behavior fails to read issues.

  16. bilogic commented on Sep 16, 2026

    @bilogic
    bilogic
    on Sep 16, 2026
    More actions

    To be clear, the problem is that we can't copy and paste like "normal"

    There is actually nothing wrong with enabling the mouse, in fact, I would say it is a good thing because it can do scrolling and is aware of the different panels on the TUI, i.e. with mouse enabled, selecting text is restricted to only that panel instead of the entire TUI

  17. neriousy commented on Oct 1, 2026

    @neriousy
    neriousy
    on Oct 1, 2026
    Member
    More actions

    Closing as a duplicate of #4283, which tracks copy to clipboard not working in the TUI. Please add your environment (code-server, Codespaces, Remote SSH) there.

  18. neriousy
    closed this as a duplicateof Copy To Clipboard is not working #4283 on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @kommander
    kommander

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

    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.