linux(x11): Add support for pasting images from clipboard (#29387)
Closes: https://github.com/zed-industries/zed/pull/29177#issuecomment-2823359242 Removes dependency on [quininer/x11-clipboard](https://github.com/quininer/x11-clipboard) as it is in [maintenance mode](https://github.com/quininer/x11-clipboard/issues/19). X11 clipboard functionality is now built-in to GPUI which was accomplished by stripping the non-x11-related code/abstractions from [1Password/arboard](https://github.com/1Password/arboard) and extending it to support all image formats already supported by GPUI on wayland and macos. A benefit of switching over to the `arboard` implementation, is that we now make an attempt to have an X11 "clipboard manager" (if available - something the user has to setup themselves) save the contents of clipboard (if the last copy operation was within Zed) so that the copied contents can still be pasted once Zed has completely stopped. Release Notes: - Linux(X11): Add support for pasting images from clipboard
This commit is contained in:
parent
cd86905ebe
commit
ef33666701
5 changed files with 1240 additions and 49 deletions
|
@ -1479,6 +1479,21 @@ pub enum ImageFormat {
|
|||
Tiff,
|
||||
}
|
||||
|
||||
impl ImageFormat {
|
||||
/// Returns the mime type for the ImageFormat
|
||||
pub const fn mime_type(self) -> &'static str {
|
||||
match self {
|
||||
ImageFormat::Png => "image/png",
|
||||
ImageFormat::Jpeg => "image/jpeg",
|
||||
ImageFormat::Webp => "image/webp",
|
||||
ImageFormat::Gif => "image/gif",
|
||||
ImageFormat::Svg => "image/svg+xml",
|
||||
ImageFormat::Bmp => "image/bmp",
|
||||
ImageFormat::Tiff => "image/tiff",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An image, with a format and certain bytes
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Image {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue