whatsapp-for-linux
whatsapp-for-linux copied to clipboard
Can't paste images into chat
Description Having the chat text box focused, one can't paste images from the clipboard in it. For now, the user has to attach an image and select one from the file system.
To Reproduce Steps to reproduce the behavior:
- Copy some image content to the clipboard, e.g. a screenshot.
- Open a chat and focus on the text box.
- Paste the contents, nothing happens.
Expected behavior The client should accept the contents from the clipboard and display a preview for the image, allowing to add a description, etc -- a WhatsApp feature, I believe.
Screenshots
Environment
- Arch Linux
- AUR
Hi @emyller. Normally, if I copy the path from my file manager, it works. Could you tell me how do you copy and what you get when you paste it to another text area i.e. your browser's search bar?
Hi, I found this issue when I experienced this problem. Another example is when copying an image displayed in the web browser (like this one) via the right click->copy image, and trying to paste it in whatsapp-for-linux.
Normally, a text field shouldn't display anything when pasting this img copied contents, but if it supports images (as whatsapp web), it should load the image. Anyway, sometimes (I don't remember exactly where) when pasting the image in a text field, a base64 encoding of the image may appear.
@vfmatzkin Thanks a lot, makes sense. So, it doesn't work with the images copied into memory I guess, not with image paths.
@eneshecan Sorry, I forgot to reply to your first message. @vfmatzkin Thank you for adding the context!
Any updates on this? I need this feature frequently and end up opening it on my browser far too much.
Any prediction of when this feature will come?
Unfortunately not soon as I am not fully available until the end of June. Sorry for the inconvenience... I think it requires a bit of work involving handling some clipboard data in webkit2gtk but I didn't have a chance to look closely. If someone tries to do it, I can review and merge.
Here I tried to do this in a separate branch, yet without success. https://github.com/eneshecan/whatsapp-for-linux/tree/feature/paste_image_buffer. Any help is appreciated.
I just tried the following JavaScript code in both WhatsApp-for-Linux and Firefox:
document.onpaste = function (event) {
console.log(event);
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
for (var index in items) {
var item = items[index];
if (item.kind === 'file') {
var blob = item.getAsFile();
var reader = new FileReader();
reader.onload = function (event) {
console.log(event.target.result);
};
reader.readAsDataURL(blob);
} else {
console.log(item);
}
}
};
When pasting an image in Firefox, the event.clipboardData.items
contains one item. In WhatsApp for Linux, this object is empty, even though the event gets fired. When pasting text, it works perfectly.
Apparently, that is the event WhatsApp Web uses to get a pasted image.
EDIT: Epiphany also doesn't support this.
Relevant issue from Tangram: sonnyp/Tangram#103. Relevant bug from WebKit's BugZilla: https://bugs.webkit.org/show_bug.cgi?id=218519
Apparently this needs to be fixed by WebKit then?
Related to this issue, I also want to add that it seems like copying image from WhatsApp for Linux doesn't seem to work.
I tried copying an image from WhatsApp for Linux and pasting it to other chat apps (Telegram, Slack), doesn't work.
I can confirm that I'm able to do this on Telegram and Slack by copy pasting images from the internet browser.
Relevant issue from Tangram: sonnyp/Tangram#103. Relevant bug from WebKit's BugZilla: https://bugs.webkit.org/show_bug.cgi?id=218519
Apparently this needs to be fixed by WebKit then?
Seems like it. Maybe there are some workarounds we can apply but until then, this seems to be on their side.
Hi guys. No actual updates / workarounds for this issue yet ? I copy/paste screenshot images all the time for work purposes and definitely do not want to have to save all images on hdd before sending over... This problem makes me have to use the web version of whatsapp, which I dislike a lot... Any progress on this would be great! Cheers for the status update and time with this :)
I don't really have a solution for you, but I currently run chromium with the --app flag as a way to sort of have whatsapp as a separate browser.
On Mon, Nov 15, 2021 at 6:01 AM ravenlost @.***> wrote:
Hi guys. No actual updates / workarounds for this issue yet ? I copy/paste screenshot images all the time for work purposes and definitely do not want to have to save all images on hdd before sending over... This problem makes me have to use the web version of whatsapp, which I dislike a lot... Any progress on this would be great! Cheers for the status update and time with this :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eneshecan/whatsapp-for-linux/issues/79#issuecomment-968724066, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJRW3AS7RMXLEF7GOF4ROETUMDK6XANCNFSM4V4V7SCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Ok, thanks for the update. I'll look into doing something like that for now.
Hi, any progress on this? hope it can be done soon...would appreciate it a lot! cause it's even more important than videocalls i think :) You can do it! :D
Just checked epiphany if it does work there since they use webkit2gtk
too. Unfortunately, it's the same situation. I tried a couple of things as well but I am out of solutions right now.
I believe this issue should be closed. This problem is related to WebkitGTK as we can see here. In my humble opinion I suggest either creating an initiative for a workaround or making the problem visible so that more people can contribute directly to WebKit.
Well, meanwhile, searching found a very good solution that can do the paste images from clipboard for whatsapp, it's called Ferdi - https://getferdi.com/ and now i'm happy cause i can have all the messengers in one place :)
@SolidCapo Thanks! Recently some issues made me abandon Franz, and start using whatsapp-for-linux instead, but Ferdi looks like a good replacement for Franz indeed.
@SolidCapo Thanks! Recently some issues made me abandon Franz, and start using whatsapp-for-linux instead, but Ferdi looks like a good replacement for Franz indeed.
I think it will help you too, the only thing i hope one day will be available, are the videocalls in whatsapp and messenger :+1:
Would be cool if we had something like this in AUR: https://github.com/ttys3/archlinux-webkit2gtk
install on Ubuntu with snap, also having problem pasting images and files!!!
Hi! Do you think this feature is possible?
Hi! Do you think this feature is possible?
This is a problem with WebKit that strangely wasn't solved for a long time, even though it has a patch that solves it.
https://aur.archlinux.org/packages/webkit2gtk-imgpaste
I don't want to depend on that aur package instead of the stable one. If someone wants to create a different package depending on the fixed aur version i.e. whatsapp-for-linux-imgpaste
, please welcome.
I don't want to depend on that aur package instead of the stable one. If someone wants to create a different package depending on the fixed aur version i.e.
whatsapp-for-linux-imgpaste
, please welcome.
I don't think you need to do that, the AUR package already provides webkit2gtk. But I think this info would be cool to have this info in a pinned comment in the AUR package page.
Done!