When running Codex in a WSL bash window with WSL interop disabled to reduce access from WSL to Windows tools, Codex’s “paste screenshot / paste image from clipboard” workflow can stop working because it relies on Windows-side clipboard access via interop. This script works around that by saving the current clipboard image inside WSL and pasting the resulting WSL file path as plain text into the terminal. Code is in an experimental / early development state.
When you press the hotkey (ctrl + alt + f):
- Saves the image currently in your clipboard to
/home/<user>/.codex/clipboard/in WSL - Pastes the resulting WSL file path into the active WSL console window
- Restores your clipboard image afterwards (so you don’t lose the screenshot)
- Download the latest
wsl-codex-snapshot-*.exefrom GitHub Releases (recommended), or install AutoIt v3 and runwsl-codex-snapshot.au3 - Copy a screenshot to your clipboard (snip with shift + windows key + s)
- Focus your WSL Codex console window
- Press
ctrl + alt + f
You should see the path pasted into the terminal. Tooltips are shown only for errors (for example: no image on the clipboard, or the active window isn’t the expected WSL console).
Saved to:
/home/<user>/.codex/clipboard/clip_*.png
This script keeps the latest 10 images (older clip_*.png files are pruned).
The clipboard/ folder is created automatically when saving.
- Works with the classic Windows console window (
ConsoleWindowClass) and Windows Terminal (CASCADIA_HOSTING_WINDOW_CLASS). - In the classic Windows console, it expects English menu labels (
Edit->Paste). - The WSL window title must include
"{user}@{machinename}:"(used to detect the target window and extract<user>). /home/<user>/.codex/must already exist.
An AutoIt tray icon appears while running. Right-click it to exit the script.
MIT — free to use, modify, and share. See LICENSE.