I want to send an image which I see in DigiKam via WhatsApp.
What is the easiest way to do this?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
To send images from my computer I use the WhatsApp web interface, I was able to drag and drop files into their flexible interface https://web.whatsapp.com/ Here is a link to how to setup using your browser with WhatsApp and reading a QR code, https://osxdaily.com/2020/05/02/how-use-whatsapp-web-browser/ - but typing into Google "how to use whatsapp from browser" and following the instructions works well too.
No native WhatsApp application that supports receiving files as arguments is available for Ubuntu yet. All the available solutions rely on WhatsApp Web and implement some sort of web browser.
So drag and drop images from DigiKam to your WhatsApp "application" / web browser is the obvious way.
Application launchers are located in the
/usr/share/applications/ directory. These launchers are files with
.desktop extension and each contain something like this:
[Desktop Entry] Name=Amazon Comment=Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more Type=Application Categories=Network; Icon=amazon-store Exec=/usr/share/ubuntu-web-launchers/amazon-launcher X-Ubuntu-Gettext-Domain=ubuntu-default-launchers
The above example is for the amazon app.
In order for an app to be available and usable in the open with menu when a file is selected, it needs to have two things in its
.desktop launcher file:
Exec key code which is in this case
%F if the app is capable of accepting multiple files as arguments or
%f if it can only accept a single file as an argument. This code is added at the end of the
Exec= line with a space before it. So that line from the above example will look like this:
MimeType= which specifies file type association. For images for example, this line needs to be present in the
.desktop application launcher and looks like so:
So the end result of the example above will look like so:
[Desktop Entry] Name=Amazon Comment=Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more Type=Application Categories=Network; Icon=amazon-store Exec=/usr/share/ubuntu-web-launchers/amazon-launcher %F X-Ubuntu-Gettext-Domain=ubuntu-default-launchers MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/svg+xml;image/tiff;image/x-bmp;image/x-gray;image/x-icb;image/x-ico;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;image/x-pcx;image/x-targa;image/x-tga;image/openraster;
What you need to do is to find the
.desktop launcher file for your application and modify it like the above example. Your application will then be available in the open with menu. That being said, your application must have the capability of accepting files as arguments and be able to handle them properly or otherwise the arguments will be ignored by the application.
One more thing: If you have installed DigiKam from snap, I would advise to remove it like so:
sudo snap remove digikam
then, reinstall it with APT like so:
sudo apt install digikam
APT installed applications provide better integration with other desktop applications.
Amazon app is not capable of handling file arguments and I used it as just an example on how application launchers are modified, how they look and where they are located.
This is a more detailed explanation of this answer.
To Drag and drop from DigiKam to a browser tab with Web Whatsapp, you can:
If the part of the Web Whatsapp window where you want to drop the image is not visible, after you Click and partially drag the image, and before you drop it, you can <Alt>+<tab> (as many times as needed) to switch to Web Whatsapp, and then drop the image in the region of the browser of your choice.