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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy-paste doesn't work on Wayland #110

Closed
PureTryOut opened this issue Sep 6, 2021 · 8 comments
Closed

Copy-paste doesn't work on Wayland #110

PureTryOut opened this issue Sep 6, 2021 · 8 comments

Comments

@PureTryOut
Copy link
Collaborator

On X11 however it works fine. This makes it hard to enter my password and I have to switch to an X11 session 馃槩

Tested on KDE Plasma 5.22

@kepet19
Copy link
Contributor

kepet19 commented Sep 6, 2021

Hey i was looking around found out:
Alacritty has a fork off clipboard called copypasta that supports wayland.
https://github.com/alacritty/copypasta
Then we don't need to change anything than the dep maybe?

@PureTryOut
Copy link
Collaborator Author

Good find. rust-clipboard seems unmaintained as well, I'll give the fork a shot.

@kepet19
Copy link
Contributor

kepet19 commented Sep 6, 2021

I tried it. The API has change a little bit, but it works perfekt on Sway.

kepet19 added a commit to kepet19/Leafish that referenced this issue Sep 6, 2021
@PureTryOut
Copy link
Collaborator Author

Tried it as well, and so far no luck 馃

@PureTryOut PureTryOut changed the title Copy-paste doesn麓t work on Wayland Copy-paste doesn't work on Wayland Sep 6, 2021
@kepet19
Copy link
Contributor

kepet19 commented Sep 6, 2021

Ohh Yeah I forgot about it, I also had problems copy paste with alacritty.
https://www.reddit.com/r/swaywm/comments/b0r9rt/is_there_any_solution_to_copypaste_in_alacritty/
This should not be the work around I think, I forgot I installed it.

@PureTryOut
Copy link
Collaborator Author

Yeah it definitely requires more work than just adapting the API (although updating the dep is still a good thing, I'll make a PR for that anyhow).

alacritty/copypasta#27
https://github.com/alacritty/copypasta/blob/master/src/wayland_clipboard.rs#L36

We need to give the clipboard a pointer to the Wayland display.

@kepet19
Copy link
Contributor

kepet19 commented Sep 6, 2021

    #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
    pub unsafe fn new(display: Option<*mut c_void>) -> Self {
        match display {
            Some(display) => {
                let (selection, clipboard) =
                    wayland_clipboard::create_clipboards_from_external(display);
                Self { clipboard: Box::new(clipboard), selection: Some(Box::new(selection)) }
            },
            None => Self::default(),
        }
    }

https://github.com/alacritty/alacritty/blob/531e494cf9a90de91dbbb84cb6cfc3158b78f1f2/alacritty/src/clipboard.rs

Not sure if we can do it this way through winit
rust-windowing/winit#162 (comment)

kepet19 added a commit to kepet19/Leafish that referenced this issue Sep 11, 2021
kepet19 added a commit to kepet19/Leafish that referenced this issue Sep 11, 2021
PureTryOut pushed a commit that referenced this issue Sep 11, 2021
@PureTryOut
Copy link
Collaborator Author

Fixed in 0dcb82e

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

No branches or pull requests

2 participants