Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Rust

on:
pull_request:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
CARGO_TERM_COLOR: always

jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Cache Cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Run Clippy
run: cargo clippy --workspace --all-targets --locked -- -D warnings
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
# - cache-hit : Whether the executable was read from cache. Ex. "true"
# - bun-version : The output from running `bun-version`. Ex. "1.0.0"

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install just
# casey/just: https://just.systems/man/en/chapter_6.html
# taiki-e/install-action: https://github.com/taiki-e/install-action
Expand Down
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
env.sh

## ------------------------------------
## Ignore Patterns - Rust

# Generated by Cargo: compiled files and executables.
debug/
target/
dist/

# Keep Cargo.lock for executable crates such as clipboard/wsl-clipboard.

# Backup files generated by rustfmt.
**/*.rs.bk

# Debugging and profiling output from Rust toolchains.
*.pdb
*.profraw

# --------------------------------------------------
# TypeScript
# --------------------------------------------------
Expand Down
56 changes: 56 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]
members = ["clipboard"]
resolver = "2"

[workspace.package]
edition = "2024"
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,15 @@ other Codex MCP servers remain local. Run `bun run codex/config.ts` for its
usage and options.

### WSL Clipboard Integration
- Custom `pbcopy` and `pbpaste` commands that work with Windows clipboard
- Neovim configured to use system clipboard across WSL/Windows boundary
- Automatically removes Windows line endings when pasting
- A persistent Rust bridge that keeps one PowerShell clipboard process warm
- `pbcopy`, `pbpaste`, `wsl-pbcopy`, and `wsl-pbpaste` are symlinks to the one
installed bridge binary; it dispatches by the command name
- Lossless UTF-8 text across the WSL/Windows boundary, including emoji and
non-BMP Unicode; PowerShell performs the internal UTF-16 conversion
- `just sync` installs `~/.local/bin/wsl-clipboard` on WSL; its daemon starts
only on the first copy or paste request
- `legacy-pbcopy` and `legacy-pbpaste` retain the old one-shot commands for
diagnostics and performance comparison


## Requirements
Expand Down
3 changes: 3 additions & 0 deletions bin/legacy-pbcopy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
# One-shot pre-Rust WSL clipboard copy command, retained for benchmarks.
clip.exe
3 changes: 3 additions & 0 deletions bin/legacy-pbpaste
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
# One-shot pre-Rust WSL clipboard paste command, retained for benchmarks.
powershell.exe "(Get-Clipboard).TrimEnd()" | tr -d "\r" | sed -z 's/\n$//'
2 changes: 0 additions & 2 deletions bin/pbcopy

This file was deleted.

3 changes: 0 additions & 3 deletions bin/pbpaste

This file was deleted.

9 changes: 9 additions & 0 deletions clipboard/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "wsl-clipboard"
version = "0.1.0"
edition.workspace = true

[dependencies]
base64 = "0.22.1"
fs2 = "0.4.3"
libc = "0.2.177"
Loading