anthropics / anthropics/claude-code
[BUG] TUI copy-to-clipboard silently fails on Wayland (kitty) even though wl-copy is installed and working (2.1.201) — backend present, unlike #84184
- Ngôn ngữ chính
- Python
- Star
- 145k
- Fork
- 23.1k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet (closest is #84184, which covers the *missing-backend* case — this is the opposite: backend present and working)
- [x] This is a single bug report
- [ ] I am using the latest version of Claude Code (on 2.1.201 — see below; will retest on latest if asked)
### What's Wrong?
## Environment
- Claude Code **2.1.201**
- Linux 6.18.37 x86_64 (Nix-based system), **fish** shell
- Terminal: **kitty** (`TERM=xterm-kitty`)
- Session: Wayland (`WAYLAND_DISPLAY=wayland-1`) — note `DISPLAY=:0` is **also** set (XWayland)
- Clipboard utilities: `wl-copy` 0.9.3 present at `~/.nix-profile/bin/wl-copy` and on `PATH`; `xclip` and `xsel` are **not** installed
## What happens
Copying text out of the Claude Code TUI does not reach the system clipboard — pasting afterwards yields nothing / stale content. No error or warning is shown anywhere.
The clipboard stack itself is fine in the very same environment: running `wl-copy < file` from a Bash tool call inside the same Claude Code session put the content on the clipboard immediately and pasting worked. So this is not the missing-backend situation from #84184 / #67486 — the backend exists, is on `PATH`, and works when invoked directly.
## Why this might be happening (untested hypothesis)
Given that:
- `wl-copy` is installed and functional,
- `xclip`/`xsel` are absent,
- **both** `DISPLAY` and `WAYLAND_DISPLAY` are set (standard on Wayland desktops with XWayland),
a backend-selection order that checks `DISPLAY` first and picks an X11 utility path would land on a missing `xclip`/`xsel` and fail — apparently silently, same failure *symptom* as #84184 but with the opposite root cause (backend present, wrong one chosen). The CHANGELOG entry for 2.1.161 ("clipboard now uses `wl-copy`/`xclip`/`xsel` on Linux when available") is where this selection logic appears to have been introduced.
kitty also supports OSC 52 writes out of the box, so an OSC 52 fallback would have worked here too.
## Real-world impact
Same as #84184 describes: the failure is completely silent, so the user experiences it as "the clipboard feature is broken" with nothing to go on. Whatever the resolution, a visible error when a clipboard write fails (or when the chosen backend is missing) would turn a debugging session into a one-line fix.
## Notes
- Exact UI action used for the failed copy (mouse drag-release auto-copy vs. keybinding) — happy to pin down and follow up with a precise repro if useful.
- Related: #84184 (missing-backend silent failure), #67486.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Start by locating the Linux clipboard selection described in the CHANGELOG entry for 2.1.161 and reproduce the TUI copy action in kitty with both DISPLAY and WAYLAND_DISPLAY set. Verify which backend is selected and capture the failure path; done means copying reaches the clipboard in this environment and a failed write is surfaced.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- fish, linux, python
- Lĩnh vực
- cli, operating-systems
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100