Repository navigation
Description
Problem
There is no way to toggle mouse tracking in the OpenCode TUI from inside the session. When running OpenCode on a remote machine over SSH from the macOS Terminal app, this makes it impossible to copy text from the TUI reliably.
Repro
- SSH into a remote host (e.g.
ssh user@host). - Run
opencodeon the remote host. - Try to select text with the mouse and copy it.
- Expected: the selected text lands in the local macOS clipboard.
- Actual: text is not copied.
Cmd+Cis intercepted by the TUI and does nothing useful. Mouse selection is captured by the TUI itself, so it never reaches the terminal's native selection buffer either.
Why this happens
OpenCode's TUI captures mouse input by default (enableMouse() in the renderer setup). On selection it tries to write to the clipboard via OSC52 (console.onCopySelection).
That only works when the local terminal actually implements OSC52. macOS Terminal.app only gained OSC52 support in macOS Sonoma 14.4 / Terminal 2.13. On older Terminal.app, on remote SSH sessions where OSC52 is filtered or unsupported by the mux, or when running inside tmux/screen without set-clipboard on, the selection silently disappears into the TUI and the user has no way to copy.
The existing escape hatch is OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=1, but it only disables the intercept("key", ...) handler. It does not disable mouse tracking, so the TUI still captures mouse drag selections and the text still does not reach the terminal's native selection buffer.
Proposed solution
Expose a user-facing toggle to disable mouse tracking in the TUI. Either of these would solve the problem:
- A
/mouseslash command that toggles mouse capture on/off. - A configurable hotkey for the same.
- An opt-in config field under
tui(e.g.tui.mouse = falseortui.mouse_tracking = false) that defaults to current behavior but can be turned off.
When mouse tracking is off, the user gets normal terminal mouse selection and can copy via Cmd+C / Shift+drag / the terminal's own copy mechanism, regardless of OSC52 support.
For reference, hermes-agent already ships a /mouse toggle for exactly this use case and it works well there.
Environment
- opencode 1.17.15
- macOS Terminal.app (no third-party terminal)
- Connected over SSH to a remote Linux host
OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=1does not help (see above)
Activity
github-actions commentedon Jul 10, 2026
This issue might be a duplicate of existing issues. Please check:
tui.mouse: falseconfig option to disable mouse capture in the TUI for better terminal multiplexer / SSH compatibility. The proposed solution there is nearly identical."mouse": falsesetting intui.jsonalready exists, but has a bug where wheel events fall back to arrow keys and trigger prompt-history navigation instead. You may want to check whethertui.mouse: falsein your~/.config/opencode/tui.jsonaddresses your use case (with the caveat of the known wheel regression in tui.json "mouse": false causes mouse wheel to fall back to arrow keys, triggering prompt-history navigation instead of scrolling the message viewport #35295).tui.copy_on_selectconfig option to prevent automatic clipboard copies on selection — overlaps with the copy side of the problem you describe.github-actions commentedon Sep 9, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
lucassing commentedon Sep 24, 2026
having the same issue at the moment