WhatsApp is one of the most popular messaging applications in the world, yet for some reason, they still don’t officially support the Linux platform with an official desktop application. So, if you want to use WhatsApp on Linux, you’ll need to make your own application.
On Linux, the best and quickest way to create a web application is with the Nativefier program. To install Nativefier, head over to this guide and follow along to learn how to set up WhatsApp on your Linux PC. Then, when Nativefier is set up, continue with this guide to learn how to create your own WhatsApp app on Linux!
Download the WhatsApp icon
Every program on Linux needs a proper icon. Since we’re creating a WhatsApp web app for Linux, we’ll need to download the proper app logo from the internet. To do this, launch a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, use the wget command to download the WhatsApp logo to your home directory (~).
wget https://cdn3.iconfinder.com/data/icons/social-network-30/512/social-01-512.png -O icon.png
Generate a WhatsApp Linux app
Now that the WhatsApp icon is done downloading, we have all of the resources to create a new Linux WhatsApp app. To start the creation process, open up a terminal window and move the shell from the home directory (~) to the “/tmp” folder. The shell must be in “/tmp,” as its the safest place to generate files that don’t need to stick around for very long. Using the CD command, move to “/tmp.”
Once inside of “/tmp” you’ll need to create a build folder. This build folder will house all of the resources for our WhatsApp program generated with the Nativefier tool. To create the new build folder, use the mkdir command below.
mkdir -p whatsapp-build
After creating the new “whatsapp-build” folder, you’ll need to move the terminal session into it, as Nativefier will be working in it in the “/tmp” folder. To move to the “whatsapp-build” folder, use the following CD command.
Now that the patch is done downloading call Nativefier to generate a Linux-compatible binary centered around WhatsApp’s webchat interface.
nativefier -p linux -a x64 -i ~/icon.png --inject whatsapp_fix.js --single-instance https://web.whatsapp.com/
Let the Nativefier application generate the WhatsApp binary on Linux. It may take a couple of minutes. When the generation process is complete, run the ls command inside of the “whatsapp-build” directory, and you’ll see a sub-directory with the label of “whats-app-web-linux-x64”.
Rename the binary and folder
Now that the WhatsApp is created in the “whatsapp-build” folder, some files and folders need to be re-named, as Linux shortcuts don’t work as well with convoluted folder names.
The first thing that must be renamed is the WhatsApp binary file. Using the CD command, move into the “whats-app-web-linux-x64” directory that has the “whats-app-web” binary, and using mv rename it to “whatsapp.”
mv whats-app-web whatsapp
After renaming the binary file in the generated app folder, the app folder itself needs to be renamed. Using the CD command move back one folder so that the terminal session is back in “whatsapp-build.”
Once in the “whatsapp-build” directory, use the mv command to rename the generated app folder to “whatsapp.”
mv whats-app-web-linux-x64 whatsapp
Once the files are all renamed, use the mv command and place them in the /opt/ directory.
sudo mv /tmp/whatsapp-build/whatsapp/ /opt/
Be sure to update the permissions of the “whatsapp” folder, or the app won’t launch.
sudo chmod 755 -R /opt/whatsapp/
Creating the desktop shortcut
Now that the hard part is over and we’ve successfully generated a new WhatsApp Linux app, it’s time to make the desktop shortcut so that it’s easy to launch WhatsApp from the Linux desktop.
The first step in making a WhatsApp desktop shortcut is to create the desktop file. Using the touch command, create a file labeled “whatsapp.desktop” in “/tmp/whatsapp-build/.”
After generating the desktop file, code needs to be added to it so that it will launch the program successfully. Open up the new desktop file in the Nano text editor using the command below.
Paste the code below into the Nano text editor and save it with Ctrl + O.
[Desktop Entry]Comment[en_US]=WhatsApp for Linux.
GenericName[en_US]=WhatsApp for Linux.
Exit Nano with Ctrl + X. Then, update the permissions of the desktop file using chmod and install it to the application folder with the mv command.
sudo chmod +x /tmp/whatsapp-build/whatsapp.desktop sudo mv /tmp/whatsapp-build/whatsapp.desktop /usr/share/applications/
Once the WhatsApp desktop shortcut is in the application file, you’ll be able to access WhatsApp on Linux at any time in your app menu by searching for “WhatsApp.”