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

Implement sending images directly from clipboard #232

Merged
merged 2 commits into from
Jul 28, 2023

Conversation

maximbaz
Copy link
Contributor

I tend to make screenshots and send them in Signal relatively often, so it would be quite helpful if we could do it in gurk.

This PR adds support for just that - when clipboard contains an image, send it.

I wasn't sure about the interface, I saw it's possible to attach files using file://path/to/file so as a easy idea I made file://clip be treated like a special path, that looks into clipboard instead of the disk.

Feel free to change this to whatever makes more sense!

Some implementation details:

  • There is already a library for interacting with clipboard, and it supports getting images out.
  • It returns RGBA pixels for the image, but we need to send a file.
  • I picked png as an extension, and so I convert the RGBA to PNG and send it as is, along with hardcoded MIME type and file name.

What do you think?

Copy link
Owner

@boxdot boxdot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. This is great feature. I just have some minor comments.

Cargo.toml Outdated Show resolved Hide resolved
@boxdot boxdot merged commit 258f958 into boxdot:master Jul 28, 2023
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

Successfully merging this pull request may close these issues.

2 participants