Image paste via Cmd+V doesn't work on Linux (macOS-only guard)
Bug Description
When pasting images via Cmd+V (terminal paste) over SSH into Claude Code running on Linux, the clipboard image check is skipped. The paste handler only checks for clipboard images on macOS.
Root Cause
In cli.js, function GCK, the empty paste handler has a macOS guard:
if (W.length === 0 && w && _)
Where w = (k1() === "macos"). On Linux, k1() returns "linux", so w is false, and the clipboard image check never runs. An empty paste (which is what terminals send when the clipboard contains an image) is silently ignored.
Environment
- Local: macOS (Ghostty terminal, also tested Termius)
- Remote: Ubuntu 24.04 on Hetzner VPS, Claude Code v2.1.107
- Connection: SSH with cc-clip (xclip shim + SSH reverse tunnel for clipboard bridging)
What works
Ctrl+Vworks — thechat:imagePastekeybinding correctly calls xclip and reads the image via the cc-clip shimcc-clip pasteworks — the full pipeline (daemon → tunnel → shim → image file) is functional- The xclip shim correctly returns
image/pngfor TARGETS and the full image data
What doesn't work
Cmd+V(terminal paste action) — sends an empty bracketed paste, Claude Code checksw(macOS guard), finds it's Linux, does nothing
Suggested Fix
Remove the macOS guard from the empty paste check, or extend it to Linux:
// Before:
if (W.length === 0 && w && _)
// After:
if (W.length === 0 && _)
This would allow the cc-clip xclip shim approach to work seamlessly with Cmd+V paste over SSH, which is a very common setup (Hetzner VPS + SSH + Claude Code).
Related Issues
- #5277 (Image paste over SSH)
- #14635 (xclip clipboard detection)
- #25935 (TARGETS grep pattern)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗