OSC 52 clipboard writes should include PRIMARY selection (`p`) on Linux
Problem
When mouse capture is active (e.g., flicker mode), Claude Code handles text selection and sends the selected text to the system clipboard via OSC 52. However, it only writes to the standard clipboard (c target), not the PRIMARY selection (p target).
On Linux, users rely heavily on middle-click paste, which reads from the PRIMARY selection buffer — a separate buffer from the standard clipboard. Because Claude Code only writes to c, middle-click paste doesn't work with text selected inside Claude Code's terminal UI.
Current behavior
- User selects text in Claude Code (mouse capture active)
- Claude Code sends
ESC ] 52 ; c ; <base64> ESC \ - Text is available via Ctrl+Shift+V (clipboard) but not via middle-click (PRIMARY)
- User sees:
sent N chars via OSC 52 · check terminal clipboard settings if paste fails
Expected behavior
On Linux, Claude Code should also write to the PRIMARY selection so middle-click paste works:
ESC ] 52 ; p ; <base64> ESC \
Or ideally write to both c and p targets (two OSC 52 sequences), since users may paste with either method.
Environment
- OS: Fedora Linux (Wayland/Xwayland)
- Terminals tested: Tilix (VTE-based, no OSC 52 support), Ghostty (full OSC 52 support including
ptarget) - Ghostty docs confirm
p(primary) is a supported OSC 52 target: https://ghostty.org/docs/vt/osc/52
Workaround
Using Shift+click-drag to select and Shift+Middle-click to paste bypasses mouse capture and lets the terminal handle selection natively (writes to PRIMARY). This works but requires changing muscle memory.
Suggestion
- Write to both
candpOSC 52 targets on Linux - Or make the OSC 52 target configurable (e.g., a setting for
clipboard,primary, orboth)
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗