Skip to content

Clipboard image paste doesn't work on WSL (Windows Terminal intercepts Ctrl+V) #2

Closed

Description

@477174

Problem

When running OpenCode in WSL via Windows Terminal, pasting images from the clipboard with Ctrl+V doesn't work due to three compounding issues:

  1. Windows Terminal intercepts Ctrl+V at the emulator level before it reaches the app's stdin. When the clipboard contains only an image (no text), WT has nothing to paste and sends zero bytes — no event fires at all.
  2. WSLg clipboard bridge returns BMP format (not PNG/JPEG), which the LLM API rejects with: media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' or 'image/webp'
  3. wl-paste needs XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir on WSLg to access the Wayland clipboard socket, not the default /run/user/0/.

Steps to Reproduce

  1. Run OpenCode in WSL2 via Windows Terminal
  2. Copy an image to the Windows clipboard (e.g., Win+Shift+S screenshot)
  3. Press Ctrl+V in the OpenCode prompt
  4. Nothing happens

Expected Behavior

The image should be pasted into the prompt as an attachment.

Environment

  • WSL2 on Windows with WSLg
  • Windows Terminal (does not implement Kitty keyboard protocol)
  • wl-clipboard package installed (wl-paste available)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions