zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.74k stars 3.06k forks source link

jupyter allow copying images #17240

Open sigmaSd opened 2 months ago

sigmaSd commented 2 months ago

Check for existing issues

Describe the feature

Allow copying images from repl output, currenly clicking on the copy button doesn't seem to do the correct thing on linux, (I can't paste the image, and i checked with xclip it seem to have the wrong mime type) image

also side issue: would be great when clicking the copy button it changes the ui to look like a check mark, like most websites now, and if the clipboard was changed it returns to the default icon

If applicable, add mockups / screenshots to help present your vision of the feature

No response

rgbkrk commented 2 months ago

Any idea what that mimetype should be?

would be great when clicking the copy button it changes the ui to look like a check mark, like most websites now, and if the clipboard was changed it returns to the default icon

That is so much easier than the popover I was going to try. We can keep some state to make it work like you propose.

sigmaSd commented 2 months ago

would be great when clicking the copy button it changes the ui to look like a check mark, like most websites now, and if the clipboard was changed it returns to the default icon

or an animation that just changes the icon for a couple of seconds then reverts back to the original, that's even easier

if I copy an image to the clipboard (in gnome I just press the screenshot button) and run xclip -selection clipboard -t TARGETS -o it shows image/png

rgbkrk commented 2 months ago

What is coming up as the mimetype when you're clicking the Copy button in Zed's REPL output?

sigmaSd commented 2 months ago

copying an image from the output then running xclip

text/plain;charset=utf-8
pid/107999
UTF8_STRING
TARGETS
TIMESTAMP
sigmaSd commented 2 months ago

I'm on wayland seems its hardcoded to text mime type https://github.com/zed-industries/zed/blob/12dde176084c9950b78093c1e7fb13e5988292ba/crates/gpui/src/platform/linux/wayland/client.rs#L751

rgbkrk commented 2 months ago

Ahhhhh, that makes sense then. I just used the API as exposed via cx.write_to_clipboard, not realizing that Linux did not have image handling.