Skip to content

fix: ignore client clipboard updates that echo our own copy - #31

Open
maryny4 wants to merge 1 commit into
MuNeNiCK:mainfrom
maryny4:fix/clipboard-echo-loop
Open

fix: ignore client clipboard updates that echo our own copy#31
maryny4 wants to merge 1 commit into
MuNeNiCK:mainfrom
maryny4:fix/clipboard-echo-loop

Conversation

@maryny4

@maryny4 maryny4 commented Aug 6, 2026

Copy link
Copy Markdown

Problem

Copying inside the session, then pasting inside the session, is slow and unreliable — until the client-side clipboard is touched manually (opening Windows clipboard history, or copying something on the client).

Cause: when the server-side selection changes, hypr-rdp announces a format list to the RDP client. Client-side clipboard software (Windows clipboard history, clipboard managers) may rewrite the client clipboard in response, which arrives back as a client format list. hypr-rdp treated it as a fresh client copy: it fetched the data and took the Wayland selection over with its own copy — stealing selection ownership from the application the user had just copied from. Every in-session paste then went through the RDP round trip (and could dead-end in delayed rendering), instead of directly between the two Wayland applications.

Fix

Compare incoming client data against the announced server-side cache — text normalized for CRLF (Windows rewrites line endings), images byte-wise against the CF_DIB bytes we serve — and keep the owning application's selection when they match. Real client copies are unaffected.

Client-originated text is now also written to the Wayland selection with normalized line endings, so applications no longer paste stray CRLF.

Verification

Unit tests cover the text echo (CRLF-normalized), the image echo, and CRLF normalization of genuine client copies. cargo fmt --check, clippy -- -D warnings, cargo test (both feature sets) pass. Verified live over multiple in-session copy/paste cycles with Windows clipboard history enabled: pastes are instant and no longer require touching the client clipboard.

When the server-side selection changes, hypr-rdp announces a format
list to the RDP client. Client-side clipboard software (Windows
clipboard history, clipboard managers) may rewrite the client clipboard
in response, which comes back as a client format list; hypr-rdp then
took the Wayland selection over with its own copy of the data, stealing
selection ownership from the application the user had just copied from
and routing every in-session paste through the RDP round trip — pastes
inside the session became slow and unreliable until the client-side
clipboard was touched manually.

Compare incoming client data against the announced server-side cache
(text normalized for CRLF, images byte-wise) and keep the owning
application's selection when they match. Client-originated text is now
also written with normalized line endings, so Wayland applications no
longer paste CRLF.

(cherry picked from commit eabd5f3)
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.

1 participant