Skip to content

fix(x11): use xclip for persistent clipboard ownership#362

Open
Sraq-Zit wants to merge 2 commits into
savedra1:mainfrom
Sraq-Zit:fix/x11-clipboard-persistence
Open

fix(x11): use xclip for persistent clipboard ownership#362
Sraq-Zit wants to merge 2 commits into
savedra1:mainfrom
Sraq-Zit:fix/x11-clipboard-persistence

Conversation

@Sraq-Zit
Copy link
Copy Markdown

Description

In X11, the owning process must stay alive to serve SelectionRequest events. The previous native implementation held ownership for only 1 second before exiting, causing the clipboard to appear empty to other apps after the TUI closed.
Fixes #45

Changes

  • Use xclip to copy text/images so ownership persists after TUI closes
  • Check TARGETS atom before requesting image data to avoid xclip returning garbage bytes for unsupported formats

Notes

xclip must be installed for X11 clipboard to work correctly. xsel could be impelmented the same way too except for images which are unsupported

In X11, the owning process must stay alive to serve SelectionRequest events.
The previous native implementation held ownership for only 1 second before
exiting, causing the clipboard to appear empty to other apps after the TUI
closed.

- Use xclip to copy text/images so ownership persists after TUI closes
- Check TARGETS atom before requesting image data to avoid xclip
  returning garbage bytes for unsupported formats

`xclip` must be installed for X11 clipboard to work correctly.
`xsel` could be impelmented the same way too except for images
which are unsupported
@Sraq-Zit Sraq-Zit force-pushed the fix/x11-clipboard-persistence branch from f8bf1ff to 1aca5ba Compare April 20, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not copying to buffer when using clipse from a hotkey (in floating term)

2 participants