Support OSC 52 for clipboard operations over SSH

Resolved 💬 3 comments Opened Jan 26, 2026 by kae-builds Closed Mar 6, 2026

Summary

When using Claude Code over SSH, the "c" key copy feature doesn't work on the local machine because it uses local clipboard commands (pbcopy/xclip) instead of OSC 52 escape sequences.

Problem

  1. SSH into a remote server running Claude Code
  2. Press "c" to copy code/output
  3. Cannot paste on the local machine with Cmd+V/Ctrl+V

The copied content stays on the remote server's clipboard, not the local machine where the user actually wants to paste.

Proposed Solution

Add an option to use OSC 52 escape sequences for clipboard operations. OSC 52 is widely supported by modern terminal emulators (Ghostty, iTerm2, Alacritty, WezTerm, kitty, foot, etc.) and works seamlessly over SSH, including through nested tmux sessions.

Example implementation:

printf "\e]52;c;%s\a" "$(echo "text to copy" | base64)"

This could be:

  • A configuration option (e.g., clipboard: "osc52")
  • Auto-detected when running over SSH ($SSH_TTY is set)

Environment

  • Terminal: Ghostty (OSC 52 supported)
  • tmux with set-clipboard on and allow-passthrough on
  • SSH connection to remote server

Related

  • #5512

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗