feat(clipboard): implement proper Linux file reference clipboard support#103
Merged
gregpriday merged 2 commits intoFeb 26, 2026
Merged
Conversation
- Add _detectLinuxClipboardMethod() to detect display protocol and DE - Use xclip on X11 and wl-copy on Wayland with correct MIME types - GTK desktops (GNOME, XFCE, Cinnamon): x-special/gnome-copied-files - KDE desktops: text/uri-list with CRLF line ending - Unknown DEs default to GTK format as most widely supported - Add 2s spawnSync timeout to prevent hanging on broken compositors - Trim env var checks to reject whitespace-only values - Fall back to plain-text file:// URI when tools are unavailable - Add 25 unit tests covering all X11/Wayland/DE/fallback combinations
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
Replaces the plain-text
file://URI fallback on Linux with proper clipboard file reference support usingxclip(X11) andwl-copy(Wayland) with the correct MIME types recognised by GTK and KDE file managers.Closes #102
Changes Made
_detectLinuxClipboardMethod()static helper that detects display protocol ($WAYLAND_DISPLAY/$DISPLAY) and desktop environment ($XDG_CURRENT_DESKTOP) and returns the correct{ tool, args, payload }objectx-special/gnome-copied-filesMIME type withcopy\nfile:///pathpayloadtext/uri-listMIME type withfile:///path\r\npayload (RFC 2483 compliant)xclip -selection clipboard -t <mime>, Wayland sessions usewl-copy --type <mime>; Wayland takes priority when both$WAYLAND_DISPLAYand$DISPLAYare setspawnSynctimeout to prevent hanging on broken Wayland compositorsfile://URI copy when neither tool is installed or the spawn fails — no error shown to user