[BUG] Linux/Wayland: copy runs wl-copy without --type, so code-like text is offered as e.g. application/x-ruby and won't paste into Emacs/GTK apps
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- linux, typescript
- Domain
- cli
Research direction
The issue identifies the wl-copy calls, including the clipboard and --primary variants, but gives no source file or test path. Find where Claude Code assembles those commands and read the surrounding clipboard handling first. Reproduce with the supplied Ruby-like line, then verify both calls offer text/plain and the text pastes into a GTK or Emacs Wayland app.
Written by the indexing model from the issue text.
Description
What's wrong
On Linux/Wayland, Claude Code copies a selection by running wl-copy with no arguments (Q={"wl-copy":[[],["--primary"]], ...} in 2.1.329). Without --type, wl-copy guesses the MIME type from the content via xdg-mime. When the copied text looks like source code, the guess is a non-text type, and wl-copy then offers only that type, with no text/plain.
Apps that request text types only (e.g. Emacs pgtk, GTK apps) get nothing and paste nothing. wl-paste and clipboard managers still show the text, because they take whatever type is offered, so the clipboard looks fine.
Repro
- Wayland session with
wl-clipboardinstalled (WAYLAND_DISPLAYset). - In Claude Code, select and copy this line from the output:
default_area = "menupanel"; wl-paste --list-typesprints onlyapplication/x-ruby.- Paste into Emacs (pgtk): nothing is pasted.
(gui-get-selection 'CLIPBOARD 'TARGETS)returns[application/x-ruby], and(gui-get-selection 'CLIPBOARD 'UTF8_STRING)returnsnil.
Same root cause, without Claude Code:
$ printf 'default_area = "menupanel";' > t; xdg-mime query filetype t
application/x-ruby
Ordinary prose is detected as text/plain, so the bug shows up only for text that happens to look like code. That is common in Claude Code output.
Expected
The copied text is offered as text, so every app can paste it.
Suggested fix
Pass --type text/plain to wl-copy, for both the clipboard and the --primary calls. Claude Code always copies text, so the type never needs guessing. With text/plain, wl-copy also offers the usual text aliases (text/plain;charset=utf-8, UTF8_STRING, TEXT, STRING).
Environment
- Claude Code 2.1.329
- Linux 6.18, NixOS, niri (Wayland)
- wl-clipboard 2.3.0
- GNU Emacs 31.1 (pgtk)
- Dominant language
- TypeScript
- Stars
- 158k
- Forks
- 25.1k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 4
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from anthropics/claude-code
-
area:tools bug has repro
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
anthropics/claude-code#113984 ·
-
area:docs bug documentation
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
anthropics/claude-code#113843 ·
-
area:hooks area:plugins bug platform:windows
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anthropics/claude-code#113812 ·
-
[FEATURE] Windows Terminal: OSC 9;4 progress is turned off although Windows Terminal renders itOpenarea:tui enhancement platform:windows
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
anthropics/claude-code#113765 ·
-
area:ide bug has repro platform:macos platform:vscode
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anthropics/claude-code#113738 ·
All issues in anthropics/claude-code
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tashfeenahmed/freellmapi#2305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
prime-radiant-inc/evener#8335 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vercel-labs/ui#1921 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
microsoft/monaco-editor#5626 ·
Maintainers usually reply within 1 day