[BUG] Copying to clipboard prefers wl-copy
Status Open
Reported on v2.1.187
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 5 comments · opened Jun 24, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When I copy something on a local claude-code instance (by either using /copy or by selecting), the wl-copy program is used. But because of this a taskbar entry is made for a split second, so it is quite annoying.
I don't need wl-copy. My terminal supports OSC52. When I use claude-code over an SSH connection, it doesn't need to do any of this and it still manages to update my clipboard
What Should Happen?
It should skip wl-copy when OSC52 is supported
Error Messages/Logs
Steps to Reproduce
Open claude-code in a terminal locally
Use the KDE Plasma desktop environment on Linux
Copy something
For a flash, a new application will open
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.187
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
_No response_
5 Comments
Same root cause, much worse impact on GNOME 50 (mutter 50.3) — a single
/copypermanently breaks the system clipboard.Confirming this with a far more severe symptom. The "taskbar entry for a split second" is
wl-copycreating a realxdg_toplevelto grab keyboard focus (needed for a validset_selectionserial, since mutter exposes nodata-controlprotocol). On GNOME 50 / mutter 50.3, that wedges the compositor'swl_data_deviceselection permanently for the rest of the session.After one
/copy: no GUI app can read or write the CLIPBOARD (verified with gedit, Chrome, Vivaldi).set_selectionis silently ignored — mutter re-sends the current selection instead of sendingcancelled, so orphanedwl-copydaemons pile up (34 after a few hours).WAYLAND_DEBUGshows the surface is created but never receiveswl_keyboard.enter:What makes it hard to spot: PRIMARY still works (different protocol,
zwp_primary_selection_device_manager_v1), so mouse-selection copy keeps working, and Chromium's internal cache makes browser-to-browser copy look fine.Recovery requires a logout/reboot.
pkill -x wl-copydoes not help. Installingxclipdoes not help either — Claude Code still pickswl-copywheneverWAYLAND_DISPLAYis set, despite referencing xclip/xsel in the bundle.Reproducible: reboot → clipboard fine →
/copy→ broken.Env: Fedora 44, GNOME 50 / mutter 50.3-2.fc44, wl-clipboard 2.2.1, Claude Code 2.1.212.
The requested OSC 52 preference would fix this, and an xclip/xsel fallback would too.
Follow-up: I verified that the OSC 52 path requested in this issue actually works, and that it also fixes the severe GNOME 50 breakage I described above.
Workaround: a PATH shim shadowing
wl-copythat emits OSC 52 to/dev/ttyinstead of talking Wayland:Result on Zed's terminal:
/copylands 1800 characters byte-identical to theresponse.mdit also writes, the selection is owned by the terminal emulator (mimepid/<zed-pid>) exactly as if I had pressed Ctrl+Shift+C, nowl-copyprocess is spawned, no invisible toplevel is created, and the compositor never wedges. Copy/paste to every GUI app keeps working afterwards.So the fix this issue asks for — prefer OSC 52 when the terminal supports it — is validated end-to-end, and on GNOME 50 it is the difference between a working clipboard and a dead one.
Two things that may help whoever picks this up:
xclipis not a workaround. The detection is effectivelyif (WAYLAND_DISPLAY && which("wl-copy")) use wl-copy, sowl-copywins unconditionally on Wayland even when xclip/xsel are present and referenced in the bundle. There is no setting to override it.--primarycall is issued alongside the clipboard one, so both selections are set; the shim above maps them to OSC 52candp.Even short of preferring OSC 52 by default, an env var or setting to pick the backend (
osc52/xclip/wl-copy) would let affected users out. Happy to test a patch.Env: Fedora 44, GNOME 50 / mutter 50.3-2.fc44, wl-clipboard 2.2.1, Claude Code 2.1.212, Zed 1.11.3.
I had a similar issue, running claude code in any terminal in intelliJ or rider - Selecting a section would produce a message saying that selection was auto-copied, however when i hit paste, it would be a different section, mostly happens when i need to scroll for longer messages.
THE FIX: Go to the global config of claude, in settings.json and remove {"tui": "fullscreen"} line
Hope this helps others
I had a similar issue, running claude code in a ssh terminal of Ubuntu. With or without rmux/tmux, Copy & Paster dose NOT work as expected.
It works fine bofore upgrade to version 2.1.220
This is a good feature, but it dose not worked anymore.