You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This helper targets Windows users running AI tools (Claude Code, Codex, etc.) inside WSL. Pressing `Alt+V` saves the clipboard image and pastes the corresponding WSL-friendly file path into the active window.
103
+
104
+
#### Background
105
+
Many modern AI-powered CLI agents (such as Codex, Amazon Q Developer CLI, etc.) are primarily optimized for Linux and macOS systems. Windows users who want to experience these tools typically need to run them through WSL2 (Windows Subsystem for Linux 2). However, WSL2 has incomplete support for certain features, with **image pasting** being a notable pain point:
106
+
107
+
-**Problem**: WSL2 terminals cannot directly access image data from the Windows clipboard
108
+
-**Impact**: Users cannot paste screenshots directly to AI tools for analysis, unlike on native Linux/macOS
109
+
-**Workaround**: Some AI CLI tools (like Amazon Q Developer CLI) work around this by using a "save image to file → pass file path" approach
110
+
111
+
#### Solution
112
+
This tool is designed to bridge this gap: pressing `Alt+V` automatically saves the Windows clipboard image to a local file and pastes the corresponding WSL path (`/mnt/c/...`) into the active window, enabling AI tools to seamlessly read the image.
113
+
114
+
**v2.0 Enhancements**: While keeping the familiar `Alt+V` workflow, this version adds input method protection, asynchronous saves, automatic cleanup, and improved tray controls so that WSL-ready paths appear instantly in your terminal. By skipping upfront SHA256 deduplication and deferring disk I/O, the new flow pastes the path in under a second without the character-by-character delay that previously took roughly three seconds.
115
+
116
+
### Highlights
117
+
-**Instant Path Output**: Paste the `/mnt/...` path immediately after `Alt+V`, trimming end-to-end latency from ~3 seconds to under 1 second and avoiding the prior character-by-character send effect.
118
+
-**Input Method Safeguard**: Temporarily switch to the English keyboard layout to avoid IME mis-typing, then restore the prior layout.
119
+
-**Asynchronous Save Pipeline**: Offload image persistence to PowerShell in the background with silent error handling, keeping the hotkey responsive.
120
+
-**Automatic Cleanup**: Periodically prune cached images older than two hours and remove leftovers when exiting from the tray.
121
+
-**Enhanced Tray Menu**: Quickly open the cache directory or exit the helper directly from the system tray.
45
122
46
123
### Requirements
47
-
- Windows 10/11 with WSL enabled
48
-
- PowerShell allowed to run local scripts (run `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` if needed)
49
-
-(Optional) Install the official [AutoHotkey v2](https://www.autohotkey.com/download/ahk-v2.exe)if you plan to edit the source `.ahk`or rebuild the executable
124
+
- Windows 10/11 with WSL2 enabled
125
+
- PowerShell 5.1+ with local script execution allowed (`Set-ExecutionPolicy RemoteSigned -Scope CurrentUser`)
126
+
-AutoHotkey v2 (already compiled into `wsl_clipboard.exe`; install only if you need to rebuild or debug)
50
127
51
128
### Usage
52
-
1. Clone the repository locally:
129
+
1. Clone the repository and move into the project folder:
2. Select `scripts\wsl_clipboard.ahk` as the source
70
-
3. Pick the desired base binary and output path, then click `Convert`
148
+
149
+
If you want to customize the hotkey, modify the temp directory path, or distribute a new `.exe`, install AutoHotkey v2 first and use the bundled Ahk2Exe compiler:
150
+
151
+
1.**Install AutoHotkey v2**
152
+
- Download and install the official [AutoHotkey v2](https://www.autohotkey.com/download/ahk-v2.exe)
153
+
154
+
2.**Modify the Script (Optional)**
155
+
-**Change hotkey**: Edit `scripts/wsl_clipboard.ahk` line 18, change `!v::` to another key combination
156
+
-`!v` = Alt+V
157
+
-`^!v` = Ctrl+Alt+V
158
+
-`^+v` = Ctrl+Shift+V
159
+
-**Change temp directory**: Edit line 5, modify the `gTempDir` variable path
160
+
-**Change cleanup interval**: Edit line 125, adjust the time parameter (default 2 hours = 7200000 milliseconds)
0 commit comments