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 — fix(clipboard): add OSC 52 fallback for SSH/tmux environments by wonderflow · Pull Request #7028 · anomalyco/opencode

Conversation

@wonderflow

@wonderflow wonderflow commented Jan 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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

  1. SSH into a remote Linux server
  2. Run opencode in tmux with iTerm2 integration
  3. Get a response from the assistant
  4. Press Ctrl+X Y to copy the assistant's message
  5. 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
All reactions
  • 👍 3 reactions
@wonderflow
fix(clipboard): add OSC 52 fallback for SSH/tmux environments
268ca1a
@github-actions

github-actions Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

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:

  • PR fix: validate DIBv5 format before fallback to DIB in Windows clipboard #2861 - Windows clipboard format validation
  • PR feat: add native X11 clipboard support for Linux #5908 - X11 clipboard support for Linux
  • PR feat: auto-compress clipboard images to avoid API size limits #6455 - Clipboard image compression

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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node requested a review from kommander January 6, 2026 04:44
This was referenced Jan 6, 2026
Desktop: Fix Paste image on empty input #7130
Merged
test: cover powershell clipboard escaping #7177
Closed
Add TMUX section for clipboard troubleshooting #7191
Closed
fix: Enhance clipboard error handling by propagating errors and checking command exit codes #7220
Closed
feat(deskop): Add Copy to Messages #7658
Merged
fix(clipboard): actually escape powershell commands #8150
Closed
This was referenced Jan 15, 2026
fix(tui): fix Ctrl+V paste on Windows/WSL2 (#6560 and #8209) #8626
Closed
fix: centralize OSC 52 clipboard support for SSH sessions #8974
Merged
fix(clipboard): improve OSC 52 escape sequence for SSH compatibility #9008
Closed
@github-actions github-actions Bot mentioned this pull request Jan 24, 2026
feat(opencode): add linux clipboard toast warnings #10332
Closed
@thdxr
thdxr force-pushed the dev branch from cbab81f to 2d3c7a0 Compare January 30, 2026 04:50
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 00637c0 to 71e0ba2 Compare January 30, 2026 14:32
@thdxr
thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@github-actions github-actions Bot mentioned this pull request Feb 3, 2026
fix(clipboard): report actual copy result instead of always showing success #11893
Closed
@github-actions github-actions Bot mentioned this pull request Feb 18, 2026
fix:solved the copy issue in TUI #14101
Closed
5 tasks done
@github-actions github-actions Bot mentioned this pull request Mar 5, 2026
fix(opencode): tmux clipboard cannot copy to system clipboard #16195
Closed
3 of 6 tasks
@github-actions

github-actions Bot commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Mar 7, 2026
@K0nigsberg K0nigsberg mentioned this pull request Sep 29, 2026
fix(tui): surface clipboard write failures instead of false success #51674
Closed
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kommander kommander Awaiting requested review from kommander

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

1 participant

@wonderflow
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.
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.