wayland: adopt custom clipboard formats on the data-control backend (#17)#131
Merged
Conversation
) Wire the custom-format seam into the Wayland data-control backend: wlRead/wlWrite/wlWatch resolve a custom Format token to its MIME string and offer/request it verbatim ([]string{mime}), since Wayland advertises selections by MIME type. Raw passthrough, no conversion. Built-ins unchanged. With both Linux backends (X11 and Wayland) now supporting custom formats, drop the WAYLAND_DISPLAY skip so the headless-sway CI job exercises the round-trip too.
On the Wayland data-control backend a freshly set selection is not immediately visible to a new reader connection, so an immediate Read can return nil. Poll Read for up to ~5s before asserting; backends that are immediately consistent (darwin, X11, Windows) succeed on the first try with no added delay.
…paste) Under wlr/ext data-control, a client does not observe its own just-set custom selection from a fresh reader connection (the built-in formats happen to work same-process, but a single-MIME custom selection does not, even after polling). The real use case is exchanging custom data with other apps, so verify that directly: - TestWaylandCustomWrite: wlWrite owns the selection; wl-paste --type reads the registered MIME back verbatim. - TestWaylandCustomRead: wl-copy --type sets binary data; wlRead reads it back verbatim. The same-process round-trip test skips under Wayland accordingly.
This was referenced Jun 6, 2026
Closed
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.
Backend PR of the custom clipboard formats design (spec). Builds on #128/#129/#130. Refs #17, #40.
Scope (Wayland data-control backend)
wlRead/wlWrite/wlWatchdefaultcase resolves a customFormattoken to its MIME string and offers/requests it verbatim ([]string{mime}) — Wayland advertises selections by MIME type, so the registry maps 1:1.FmtText/FmtImageunchanged.Tests
Both Linux backends (X11 and Wayland) now support custom formats, so the
WAYLAND_DISPLAYskip is removed fromclipboard_custom_linux_test.go.TestCustomFormatRoundTripnow runs on both the X11ubuntujob and the headless-swaywayland_testjob.Verified locally via cross-compile + test-compile for
linux/amd64.