XFixes watches X11 ownership changes. No timer repeatedly reads your clipboard.
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.
$ 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.
The service reads Wayland image/bmp and converts it to bounded PNG32.
xclip owns X11 image/png, which Codex can attach with Ctrl+V.
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
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.shCopy 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.
Later Codex or WSLg versions may fix the underlying compatibility issue.
The current implementation targets the observed WSLg screenshot format.
The bridge relies on Wayland plus the WSLg X11 compatibility path.
Images stay local in a private runtime directory and are deleted after processing.
STILL SEEING THE ERROR?