fix(clipboard): fall back wl-copy -> xclip -> xsel on Linux#111
Open
jugrajsingh wants to merge 1 commit into
Open
fix(clipboard): fall back wl-copy -> xclip -> xsel on Linux#111jugrajsingh wants to merge 1 commit into
jugrajsingh wants to merge 1 commit into
Conversation
… copy paths Wayland sessions without XWayland/xclip installed silently failed to copy on both the TUI status-line copy action and the CLI session-share clipboard helper, since both only ever shelled out to xclip on Linux. Both paths now try wl-copy, then xclip, then xsel in order (Wayland first), keeping the first candidate that works; macOS/Windows behavior (pbcopy / clip.exe) is unchanged. The candidate list is shared via a new clipboard_candidates() helper in src/utils.rs, used by both src/tui/app.rs and src/session.rs. The CLI path (src/session.rs) falls through to the next candidate on spawn failure, non-zero exit, and stdin write/wait errors, since a CLI share command can safely retry silently. The TUI path (src/tui/app.rs) falls through only on spawn failure, since a spawned-but-failing process there surfaces through the status line and a broader retry would risk misleading UX. No new dependencies.
jugrajsingh
force-pushed
the
fix/wayland-clipboard
branch
from
July 21, 2026 07:30
b21ec20 to
5ab51e8
Compare
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.
Summary
Wayland sessions without XWayland/
xclipinstalled silently failed to copy on both the TUI status-line copy action and the CLI session-share clipboard helper, since both only ever shelled out toxclipon Linux.Both paths now try
wl-copy, thenxclip, thenxsel, in order (Wayland-native tool first), keeping the first candidate that works. macOS (pbcopy) and Windows (clip.exe) behavior is unchanged. The candidate list is shared via a newclipboard_candidates()helper insrc/utils.rs, used by bothsrc/tui/app.rsandsrc/session.rs, so the fallback order can't drift between the two call sites.Behavior difference between the two call sites
src/session.rs): falls through to the next candidate on spawn failure, non-zero exit, and stdin write/wait errors, since a CLI share command can safely retry silently until one clipboard tool actually works.src/tui/app.rs): falls through only on spawn failure. A spawned-but-failing process surfaces through the status line, and a broader silent retry there would risk misleading UX (user sees "copied" when the paste buffer is actually stale).No new dependencies — this is pure fallback ordering over binaries that may or may not already be on
$PATH.Verification
cargo build,cargo fmt -- --check,cargo test --workspace— green.xclipon an X11 session (regression check) and viawl-copyon a Wayland session withoutxclipinstalled.Test plan
xclip→ copy succeeds viawl-copyxclipwl-copyspawns but write fails → falls through toxclipwl-copyspawn fails → falls through toxclip; a spawned-but-failing process does not retry