There are a lot of reasons to want a native application on Linux over a website. It runs smoother, has features that people come to expect from a desktop app (like desktop-notifications), and overall fits better into the Linux experience. The trouble is though, not a lot of mainstream applications come to the Linux platform. There is a solution though; you can use an application called Nativefier to turn websites into Linux apps.
Nativefier is a NodeJS application that runs on Linux, and other OSes that can run the Node software. As a result, this program isn’t set up by default on any major Linux distribution. Instead, we’ll need to go over how to set up Nativefier, before it’s possible to start converting websites into Linux apps.
Get Node and NPM
Like we mentioned above: Nativefier relies heavily on the NodeJS programming language, and you’ll need to have it on your system to get the Nativefier app working. Thankfully, installing NodeJS on the Linux platform is easier than ever, because many Node developers use Linux.
To install NodeJS on your operating system, open up a terminal window and follow the step-by-step instructions that match your Linux operating system below.
sudo apt install npm
su - apt-get install curl curl -sL https://deb.nodesource.com/setup_11.x | bash - apt-get install -y nodejs
sudo pacman -S npm
sudo dnf install npm
sudo zypper install npm
NodeJS is readily available on most modern Linux operating systems, via the “nodejs” or “npm” packages. However, if these packages are not available to you (for some reason), there is another way to get NodeJS working: the source code.
To get NodeJS on your Linux distribution, visit the official website’s download page. Once there, look for the Linux source downloads and grab it. Then, extract the Tar archive and follow the instructions included in the readme text file. You may also want to refer to the official NodeJS instructions for Linux.
NodeJS is up and running on Linux. Now, we must use the NodeJS tools to get Nativefier working, so that we can use it on Linux to create applications of our favorite websites. To install, open up a terminal and use the npm command.
Warning: installing Nativefier without sudo may cause issues. It’s best to do it with root privileges.
npm install nativefier -g
Let the NPM installation tool run the installation process. When done, you can access the help page with this command:
Turn websites into Linux apps
Nativefier works by generating an Electron wrapper based on the URL it gets in the command-line. To create a native Linux application out of a website, follow these steps.
Step 1: Find the website you’d like to create an app out of. Try to stick with a “web app,” or web-based tool for the browser that might as well be a program anyway. Nativefier works best this way. Once you’ve got your website in-mind, highlight the URL with the mouse, right-click on it and select the “copy” option.
Step 2: In the terminal window, use Nativefier to generate a basic app. In our tutorial, we’ll use YouTube.
nativefier -p linux -a x64 https://youtube.com
Step 3: Let Nativefier package your URL into an electron application, and pay close attention to the terminal prompt. If any errors appear, press Ctrl + Z, then re-run the command again.
Step 4: When Nativefier finishes generating an application, you’ll need to update the permissions of the application before being able to use it. To set the permissions, do:
cd *-linux-x64 sudo chmod +x *
Run your custom Electron app right on Linux with:
Custom app options
In this section of the tutorial, we’ll briefly go over some options that Nativefier has that allow the user to make a better desktop application.
Note: these commands can be entered at the same time, and there is no limit to how many used at once.
Want a system-tray on your custom Electron application? Try this command:
nativefier -p linux -a x64 https://website-app-url.com --tray
Wishing your Linux app could go full-screen? Use the full-screen command switch.
nativefier -p linux -a x64 https://website-app-url.com --full-screen
It is possible to force your Linux electron application to always start up in “maximize” mode, with the “Maximize” command-line switch.
nativefier -p linux -a x64 https://website-app-url.com --maximize
You may have a web application that relies on Flash. Luckily, Nativefier has a way to load up the Adobe Flash plugin, if you build your program with the “flash” command-line switch.
nativefier -p linux -a x64 https://website-app-url.com --flash
Always on top
Want your Electron app to ignore window manager rules and always appear on top of everything else? Try the “always on top” command-line switch when building with Nativefier.
nativefier -p linux -a x64 https://website-app-url.com --always-on-top