feat(clipboard): Add persistent WSL clipboard bridge - #25
Merged
Conversation
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.
Add persistent WSL clipboard bridge
This branch replaces one-shot WSL clipboard commands with a persistent Rust
bridge, while carrying the Rust workspace, CI, and local tooling work already
present on the branch.
Rationale
Each legacy paste launched a fresh
powershell.exe, making process creationthe dominant cost and exposing fragile UTF-8/UTF-16 clipboard boundaries. A
per-user daemon keeps one constrained PowerShell process warm and exposes only
copy, paste, status, and stop operations over an owner-only Unix socket.
The public
pbcopyandpbpasteinterface remains unchanged for Neovim andshell tooling. Image paste remains separate, and the old one-shot commands are
retained under
legacy-*names for regression and performance comparison.Key Changes
framing, and a release installation path.
pbcopy/pbpastesymlinks thatdispatch to one installed binary by invocation name.
related branch-local Herdr and Codex configuration updates.
1 - Clipboard lifecycle and compatibility
just syncinstalls one release binary and creates same-directory aliases in~/.local/bin. The first copy or paste lazily starts the daemon; subsequentclients reuse its single serialized PowerShell request/response stream. The
bridge accepts lossless valid UTF-8 text and performs the Windows UTF-16
conversion inside PowerShell, rather than requiring callers such as Neovim to
pipe UTF-16LE bytes.
The aliases add no Bash process. A short benchmark measured
pbpastethroughthe symlink at 11.0 ms median versus 10.6 ms for direct binary invocation,
which is within subprocess timing noise.
2 - Performance and text fidelity
The reusable benchmark preserves the legacy commands under explicit names and
compares them with the bridge. In the latest short run, the bridge measured
about 10.7x faster copy, 31.0x faster paste, and 21.4x faster round trips than
the retained legacy wrappers. The lower-level persistent PowerShell protocol
remains sub-millisecond after startup; end-to-end CLI timing also includes the
Linux client process and socket hop.
Unicode coverage includes multiline and trailing-newline cases, punctuation,
winfixtext-style mojibake fixtures, combining characters, Japanese, astral
Unicode, emoji, ZWJ emoji, and flags. The old image-paste workflow remains
unchanged.
3 - Branch context
This branch also contains the root Cargo workspace and Rust CI integration,
plus existing Herdr and Codex configuration changes that were already ahead of
origin/main. They are not required for the clipboard protocol itself, butthe workspace and CI changes provide its build and lint surface.