fix(tui): clipboard image paste on WSL via WSLg and Ctrl+Alt+V keybind#7
Merged
RobertWsp merged 3 commits intoRobertWsp:devfrom Mar 5, 2026
Merged
Conversation
PowerShell processes spawned from WSL cannot access the Windows clipboard session (fundamental session isolation). The previous code tried PowerShell on WSL, which always failed silently. - Skip PowerShell clipboard read on WSL (dead code, ~500ms wasted) - Fix wl-paste/wl-copy on WSLg: override XDG_RUNTIME_DIR to /mnt/wslg/runtime-dir where the Wayland socket actually lives - Requires wl-clipboard package (apt install wl-clipboard) Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Windows clipboard stores screenshots as BMP, which LLM APIs reject. When the clipboard only offers image/bmp (common on WSL via WSLg), convert to PNG using ffmpeg, ImageMagick magick, or convert before returning. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…age paste Windows Terminal intercepts Ctrl+V and doesn't pass it to terminal apps when the clipboard contains only an image. Add alternative mechanisms that bypass WT: - input_paste_image keybind (Ctrl+Alt+V) confirmed to pass through WT - /image slash command (aliases: /paste-image) - 'Paste image from clipboard' in command palette (Ctrl+P) Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #2
Type of change
What does this PR do?
Fixes clipboard image paste when running OpenCode in WSL. Three issues addressed:
wl-pasteneedsXDG_RUNTIME_DIR=/mnt/wslg/runtime-diron WSLg, not the default/run/user/0/. Fixed in the clipboard util.input_paste_imagekeybind (default: Ctrl+Alt+V) and a/imagecommand in the command palette as alternatives. Existing Ctrl+V behavior is unchanged.No changes to behavior on native Linux/macOS — WSLg detection only activates when WSL is detected. The keybind and command work on all platforms.
How did you verify your code works?
/imagecommand appears in command palette (Ctrl+P)bun run build), typecheck passesScreenshots / recordings
N/A (terminal-based interaction)
Checklist