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
- SSH into a remote server running Claude Code
- Press "c" to copy code/output
- 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
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
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:
This could be:
clipboard: "osc52")$SSH_TTYis set)Environment
set-clipboard onandallow-passthrough onRelated