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

Should not just use xclip #236

Open
zefr0x opened this issue Jun 12, 2023 · 1 comment
Open

Should not just use xclip #236

zefr0x opened this issue Jun 12, 2023 · 1 comment

Comments

@zefr0x
Copy link

zefr0x commented Jun 12, 2023

Regarding this function:

#[cfg(target_os = "linux")]
pub fn dump_image_to_clipboard(image: &DynamicImage) -> Result<(), Error> {
let mut temp = tempfile::NamedTempFile::new()?;
image.write_to(&mut temp, ImageOutputFormat::Png)?;
Command::new("xclip")
.args([
"-sel",
"clip",
"-t",
"image/png",
temp.path().to_str().unwrap(),
])
.status()
.map_err(|e| format_err!("Failed to copy image to clipboard: {}", e))?;
Ok(())
}

In Linux the xclip command just work on X11, not Wayland.

Options:

  1. xclip could be an optional dependency alongside with wl-clipboard, and warn the user if he don't have any one of them.
  2. Depend on Rust libraries to handle clipboard for both X11 and Wayland without using an external tool.
  3. Just support Wayland and deprecating X11 support using 1 or 2.
@zefr0x zefr0x changed the title Not depending on xclip Should not depend on xclip Jun 12, 2023
@zefr0x zefr0x changed the title Should not depend on xclip Should not just use xclip Jun 12, 2023
@chris-av
Copy link

Also a linux user, and use wl-clipboard. The only reason I have xclip on my system is because of silicon. Would definitely appreciate if the code took Wayland into account.

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