Image paste via Cmd+V doesn't work on Linux (macOS-only guard)

Resolved 💬 2 comments Opened Apr 15, 2026 by Jukeman9 Closed May 24, 2026

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+V works — the chat:imagePaste keybinding correctly calls xclip and reads the image via the cc-clip shim
  • cc-clip paste works — the full pipeline (daemon → tunnel → shim → image file) is functional
  • The xclip shim correctly returns image/png for TARGETS and the full image data

What doesn't work

  • Cmd+V (terminal paste action) — sends an empty bracketed paste, Claude Code checks w (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)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗