Skip to content

Conversation

@alse-sym
Copy link

@alse-sym alse-sym commented Feb 4, 2026

Summary

  • Write OSC52 escape sequences to /dev/tty instead of stdout to bypass terminal multiplexers
  • Use SSH_TTY environment variable when connected via SSH
  • Fall back to stdout when /dev/tty is unavailable (e.g., Windows)

Problem

Clipboard copy fails in terminal multiplexers (Zellij, tmux, screen) because they intercept OSC52 sequences written to stdout and don't pass them through to the outer terminal.

Solution

Write directly to /dev/tty which bypasses the multiplexer's PTY layer. This is how tools like lazygit and neovim handle clipboard operations in multiplexers.

Fixes #12082

Test plan

  • Test clipboard copy in Zellij
  • Test clipboard copy in tmux
  • Test clipboard copy outside multiplexers (direct terminal)
  • Test clipboard copy over SSH

🤖 Generated with Claude Code

Fixes clipboard copy failing in terminal multiplexers like Zellij,
tmux, and screen. These tools intercept OSC52 escape sequences written
to stdout but do not forward them to the outer terminal.

Writing to /dev/tty (or SSH_TTY when connected via SSH) bypasses the
multiplexer's PTY layer and sends OSC52 directly to the terminal
emulator. Falls back to stdout if /dev/tty is unavailable (e.g., on
Windows).

Fixes anomalyco#12082

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

This PR appears to address a related clipboard OSC52 issue with SSH compatibility. Since PR #12129 also handles SSH scenarios (using SSH_TTY environment variable) and deals with OSC52 clipboard operations, #9008 may be addressing the same or overlapping problem.

Recommendation: Check PR #9008 to determine if it's already solving this issue or if there are differences in approach (writing to /dev/tty vs other methods).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clipboard copy fails in Zellij and other multiplexers (OSC52 written to stdout instead of /dev/tty)

1 participant