-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add support for non-text clipboard content #36
Comments
While non-text clipboard support is a valid feature request, that should really never be in the form of just some arbitrary That said, this is not something I have any usecase for at all. So if someone is interested in this feature you'll likely have to send a PR yourself. |
Yeah, I've researched a bit more on how system clipboards work and it's not just as simple as putting a PNG file into the clipboard after all… Different systems handle image files differently. On Linux (X11 and Wayland) you have to set the MIME type to There seem to be other forks of rust-clipboard like arboard, but there the readme says the author is not interested in maintaining the library and will be archiving the repository soon. Copypasta seems to be the most supported one (thanks to it being used in alacritty), so introducing support for other formats to this library would make sense from a support perspective. |
Vec<u8>
as a parameter/return value instead of a String
I'm definitely happy to maintain copypasta and fix issues popping up. But it does everything I want both for Alacritty and any other application I might want to write. But as stated previously, I'm happy to put in the time to review PRs related to a more sophisticated API which includes image support. |
One feature that I really would like to implement in There are a few approaches that I can see to bring this to alacritty:
I'm currently leaning towards 2, but I'd love to get your thoughts @chrisduerr on which approach would be best |
That is intentional. We do not want to escape file paths in Alacritty. |
Why is that? Is there a security/correctness concern, or is the ability to copy a file in a file manager and paste it as a path in the terminal window not desirable to you? |
Because it is so much easier to just quote something you want escaped than to remove the escape characters from something you don't want escaped. |
@chrisduerr oh, that makes sense! My use of the term escaping was incorrect, then, because I do not care how the path gets into the terminal, as long as I have some way of getting it in there. Escaping/quoting is a fine exercise to leave up to the reader, because I know how to use quotes. If the change was only so that files get pasted as their full file paths and not base names, would that be a change that you'd consider? |
I kinda assumed that how it works already. I don't really use it myself. So I'd be open to the idea I guess. |
FYI I made a PR to rust-clipboard years ago where this was also addressed.. it's not very trivial especially considering multiple platforms. There are some thoughts on that in the PR. |
I'm not sure major changes to Focusing on text-only makes sense for something that is completely separate, but if you actually want proper clipboard management the better solution is proper integration with your window management loop. |
Worth noting that Web Clipboard API does allow for arbitrary |
Some data that goes through the clipboard is not necessarily text, one example is images. Currently copypasta uses Strings to transfer all clipboard data, which all guarantee that the data inside is valid UTF-8, and panic if it's not. This prevents users from transferring non-text data through the clipboard.
The text was updated successfully, but these errors were encountered: