A LOCAL, EVENT-DRIVEN COMPATIBILITY BRIDGE

Paste Windows screenshots into Codex CLI on WSL.

Fix the frustrating no image on clipboard error without polling, cloud services, or permanent clipboard files.

MIT licensedLocal onlyZero idle polling
codex · WSL
$ codex

Before
Failed to paste image:
no image on clipboard

After[Image #1]

THE FORMAT GAP

Codex supports images. The clipboard path is what breaks.

In the affected WSLg setup, Windows exposes screenshots to Wayland as BMP while Codex can retrieve PNG from the X11 clipboard. The bridge safely converts and republishes that image.

HOW IT WORKS

A small bridge across three boundaries.

01Observe

XFixes watches X11 ownership changes. No timer repeatedly reads your clipboard.

02Convert

The service reads Wayland image/bmp and converts it to bounded PNG32.

03Publish

xclip owns X11 image/png, which Codex can attach with Ctrl+V.

WindowsWSLgBMPPNG32Codex

INSTALL

Three commands, then test.

For Windows 11 with WSL2/WSLg, a systemd-enabled Ubuntu distribution, and a Codex CLI session whose native image paste fails.

  • Validates WSLg, systemd, X11 and XFixes
  • Installs atomically with automatic rollback
  • Runs as a hardened user service
WSL · BASH
sudo apt update
sudo apt install wl-clipboard imagemagick xclip

git clone https://github.com/shangxiang0907/\
codex-wsl-clipboard-bridge.git
cd codex-wsl-clipboard-bridge
bash ./install.sh

VERIFY

Confirm the fix before relying on it.

bash ./verify.sh

Copy a screenshot in Windows, focus the Codex CLI composer in WSL, and press Ctrl + V. Codex should display [Image #1].

USE IT WHEN NEEDED

A targeted workaround, not a replacement for native support.

Try native paste first

Later Codex or WSLg versions may fix the underlying compatibility issue.

Only BMP input is bridged

The current implementation targets the observed WSLg screenshot format.

WSLg must expose X11

The bridge relies on Wayland plus the WSLg X11 compatibility path.

No network traffic

Images stay local in a private runtime directory and are deleted after processing.

STILL SEEING THE ERROR?

Follow the full investigation or report your environment.