GeezerVison is showing github.com — fix(clipboard): add OSC 52 fallback for SSH/tmux environments by wonderflow · Pull Request #7028 · anomalyco/opencode
Conversation
wonderflow
commented
Jan 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
Clipboard copy operations (e.g., Ctrl+X Y to copy assistant message) silently fail when running opencode over SSH or in tmux on a remote Linux server without X11/Wayland display.
Root cause: The fallback path uses clipboardy, which relies on xsel/xclip and requires a local display ($DISPLAY or $WAYLAND_DISPLAY). In headless SSH/tmux environments, these tools aren't available or don't work, causing clipboard operations to fail silently.
Solution
Add OSC 52 escape sequence support as a fallback when clipboardy fails.
OSC 52 is a terminal escape sequence standard that allows applications to set the system clipboard through the terminal emulator. It's supported by:
- iTerm2
- kitty
- Alacritty
- Windows Terminal
- tmux (with set-clipboard option)
- Many other modern terminal emulators
Changes
- Added copyViaOSC52() function that sends OSC 52 escape sequences
- Handles tmux passthrough wrapping when $TMUX is set
- Modified fallback logic: try clipboardy first → fall back to OSC 52 on failure
Behavior
| Environment |
Before |
After |
| macOS local |
osascript ✅ |
osascript ✅ (unchanged) |
| Linux + X11/Wayland |
xclip/xsel/wl-copy ✅ |
xclip/xsel/wl-copy ✅ (unchanged) |
| Windows |
powershell ✅ |
powershell ✅ (unchanged) |
| SSH/tmux (no display) |
clipboardy ❌ (silent fail) |
clipboardy → OSC 52 ✅ |
No breaking changes - existing behavior preserved for all native clipboard methods.
Testing
- SSH into a remote Linux server
- Run opencode in tmux with iTerm2 integration
- Get a response from the assistant
- Press Ctrl+X Y to copy the assistant's message
- Cmd+V on local machine to verify clipboard content
Prerequisite
- Enable "Applications in terminal may access clipboard" in iTerm2 Preferences → General → Selection
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
huynle-dev, yuguorui, and jensenojs reacted with thumbs up emoji
|
The following comment was made by an LLM, it may be inaccurate:
Results
No duplicates found.
The search for the current PR (7028: "fix(clipboard): add OSC 52 fallback for SSH/tmux environments") returned only the PR itself.
While there are other clipboard-related PRs in the repository:
These are addressing different clipboard issues and platforms, not the same SSH/tmux OSC 52 fallback feature being implemented in PR #7028.
|
yuguorui reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jan 6, 2026
This was referenced Jan 15, 2026
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
kommander
Awaiting requested review from kommander
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|