Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finally fix the wayland flaky paste #7

Merged
merged 1 commit into from
Jan 8, 2025
Merged

Conversation

beeender
Copy link
Owner

@beeender beeender commented Jan 8, 2025

Quote from WlDataOffer.receive:

The receiving client reads from the read end of the pipe until EOF
and then closes its end, at which point the transfer is complete.

The original idea was passing the stdin as the write pipe fd to the
receive(). However, sometimes the clipboard content was not pasted when
the richclip was called in neovim. That could be caused that, neovim
does not read the stdout fast enough. Since when the receive call
finishes, it ends the loop and quite the program.

To fix this, just follow the doc to create a dedicated pipe.
BTW, I was too lazy to do this at the beginning, since I was not aware of
nix-rust at that time -- I didn't want to get hands dirty with 'unsafe'.

Quote from WlDataOffer.receive:
> The receiving client reads from the read end of the pipe until EOF
  and then closes its end, at which point the transfer is complete.

The original idea was passing the stdin as the write pipe fd to the
receive(). However, sometimes the clipboard content was not pasted when
the richclip was called in neovim. That could be caused that, neovim
does not read the stdout fast enough. Since when the receive call
finishes, it ends the loop and quite the program.

To fix this, just follow the doc to create a dedicated pipe.
BTW, I was too lazy to do this at the beginning, since I was not aware of
nix-rust at that time -- I didn't want to get hands dirty with 'unsafe'.
@beeender beeender merged commit fd6b146 into main Jan 8, 2025
1 check passed
@beeender beeender deleted the mc/wayland_paste_pipe branch January 8, 2025 15:22
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