Add configurable clipboard command support #114
Merged
+118
−2
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.
Problem
On Wayland, arboard's
set_text()reports success but the clipboard remains empty. This is due to Linux clipboard ownership - the application must keep theClipboardobject alive until another app requests the data (documented in arboard's README under "Clipboard Ownership").arboard provides a
.wait()method to block until data is received, but this hangs indefinitely in TUI applications since nothing immediately requests the clipboard. The README suggests storing theClipboardlong-term or using.wait(), but neither works reliably for interactive TUI apps that can't block the main thread.Solution
Detect Wayland sessions via
WAYLAND_DISPLAYand usewl-copydirectly, falling back to arboard for X11/macOS/Windows.wl-copyhandles clipboard ownership correctly by forking to background.This introduces
wl-clipboardas a runtime dependency for Wayland environments.