Skip to content

Copy to clipboard silently does nothing on Linux/Wayland (paste works fine) #54

Description

@ymajoros

Paste works great. Copy, on the other hand, goes absolutely nowhere on my machine, and I lost an embarrassing amount of an afternoon to it.

Setup: Ubuntu, GNOME Shell 49, Wayland session, Switchboard running on native Ozone Wayland (checked — the process is holding wayland-0 fds, no X11 socket anywhere). The system clipboard itself is perfectly healthy; every other app copies fine. It's Switchboard specifically, and it's specifically writing that's broken — reading is fine, which is exactly why paste sails through and copy faceplants.

Every copy path is dead, and dead quietly:

  • Claude Code's own copy (OSC 52) → nothing
  • select text + Ctrl+C → nothing
  • right-click → Copy → nothing

No error, no toast, nothing in main.log. Just silence, which is the worst kind of bug.

So I went digging. Two separate holes:

  1. public/terminal-manager.js does navigator.clipboard.writeText(...).catch(() => {}) for Ctrl+C. On Wayland/Ozone that promise just rejects — Chromium wants real window focus + a user gesture and isn't convinced — and the empty .catch quietly buries the body. It looks like nothing happened because nothing did.
  2. OSC 52 — the escape sequence Claude Code actually uses to copy — isn't handled anywhere. xterm won't do it for you, so those copies evaporate before they reach a clipboard at all.

The thing that fixed it for me: stop asking the renderer to write the clipboard and hand it to the Electron main process instead (clipboard.writeText over IPC). Main-process clipboard doesn't care about focus or gestures and writes fine on Wayland. The same path makes OSC 52 work once you register a handler that decodes the base64 and pushes it through.

PR incoming.

(Yes, forcing the whole app onto XWayland "fixes" it, but running the entire UI on XWayland just to copy one line of text feels like burning the house to light a candle.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions