| Crates.io | wsl-clip |
| lib.rs | wsl-clip |
| version | 0.5.1 |
| created_at | 2026-01-12 14:38:44.414483+00 |
| updated_at | 2026-01-12 14:38:44.414483+00 |
| description | High-performance clipboard bridge for WSL2 |
| homepage | http://www.github.com/5ocworkshop |
| repository | http://www.github.com/5ocworkshop |
| max_upload_size | |
| id | 2037890 |
| size | 106,884 |
Smart Clipboard Bridge for WSL2
wsl-clip is a clipboard utility that bridges Linux (WSL2) and Windows. It detects content types to provide the appropriate clipboard format:
It is designed to be a drop-in replacement for clip.exe with added intelligence and safety features.
cat huge.log | wsl-clip) without loading the entire file into memory.bridge connect currently sends a small test payload.Requires a Rust toolchain.
git clone https://github.com/yourusername/wsl-clip
cd wsl-clip
just build
# Or: cargo install --path .
Ensure ~/.cargo/bin is in your $PATH.
The tool attempts to infer the best format based on the input file.
# Copy an image (Bitmap)
wsl-clip screenshot.png
# Copy a PDF (File Object)
wsl-clip invoice.pdf
# Copy source code (Text)
wsl-clip src/main.rs
# Copy multiple files (File Object Drop List)
wsl-clip *.png
Reads from standard input. Useful for capturing command output.
# Copy directory listing (ANSI colors stripped by default)
ls -la --color | wsl-clip
# Copy with Markdown wrapping
wsl-clip src/lib.rs --code
Force a specific behavior to override detection.
# Force copy as a file object (e.g., to attach a source file to an email)
wsl-clip file src/main.rs
# Force copy as an image
wsl-clip img logo.png
# Copy the translated Windows path string (e.g., "\\wsl.localhost\..."')
wsl-clip path document.pdf
Experimental stub commands; bridge connect currently sends a fixed test payload rather than piping real data.
Listener (Host):
# Listen on TCP localhost:8121
wsl-clip bridge listen --mode tcp --bind 127.0.0.1:8121
Client (Container/Remote):
# Send clipboard data to the listener
wsl-clip bridge connect --mode tcp --to 127.0.0.1:8121
See wsl-clip bridge listen --daemon-help for background daemon options.
| Flag | Description |
|---|---|
--no-strip |
Raw Mode. Preserves ANSI colors and control characters. |
--crlf |
Convert Linux (\n) line endings to Windows (\r\n). |
--code |
Wrap text content in Markdown ``` blocks. |
--no-header |
Suppress the file name header when copying multiple text files. |
--tree |
Generate and prepend an ASCII file tree of the input files. |
--debug |
Enable verbose logging to stderr. |
The project includes unit tests and integration tests. The integration tests use a mock environment to simulate clipboard operations without affecting the system clipboard.
# Run all tests
just test
# Or
# cargo test
wsl-clip: Thin CLI wrapper.wsl_clip_core: Core logic library (crate: wsl-clip-core, module path: wsl_clip_core).MIT