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)
9 Comments
I came here to raise this issue.
I'd also add that many UI apps (I tried Chrome, Discord, Telegram, Spotify) do write to both selections, so it seems like that would indeed be a good choice of behavior here.
I have the same issue:
Environment
It would be good to fix. Currently I use this workaround for X11:
Same issue
In Agent view when i select text, it will show "send xxx chars via OSC 52", but nothing copied to my host clipboard.
Also
/copywont work either.Adding a more specific trigger on Linux: this manifests after pressing
<<to enter agent view (FleetView). At first start, terminal-native selection works and middle-click paste works. Once in agent view, selecting text (e.g. double-click) prints the samesent N chars via OSC 52 · check terminal clipboard settings if paste failsmessage quoted in the OP, and middle-click paste no longer reflects the latest selection.Workaround from the OP (Shift+drag select, Shift+middle-click paste) confirmed still working.
In Gnome Terminal (ie default for my distro), copying the text in Claude Code selected with the mouse seems impossible unless using the shift-select workaround approach mentioned by @lfarkas above.
That's pretty far from ideal. 😓
This exact same issue broke my regular copy-pasting workflow. As a workaround, I've been using CopyQ clipboard manager with the "Clipboard Manipulation" options (2) and (3) (store text selected using mouse, paste clipboard with mouse) activated.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This issue seems to be fixed anyway now as of v2.1.205