LinuxCommandLibrary

nativefier

Create desktop applications from websites

TLDR

Make a desktop app for a website

$ nativefier [url]
copy

Create a desktop app with a custom name
$ nativefier --name [name] [url]
copy

Use a custom icon, should be a PNG
$ nativefier --icon [path/to/icon.png] [url]
copy

SYNOPSIS

nativefier [OPTIONS]

PARAMETERS

URL
    The URL of the web page or application to be converted into a desktop app. This is a mandatory argument.

--name value
    Specifies the name of the generated desktop application. Defaults to the website's title.

--icon path
    Sets the application icon. Supports .png, .icns, or .ico file formats. Accepts a local file path or a URL.

--width pixels
    Defines the default width of the application window in pixels.

--height pixels
    Defines the default height of the application window in pixels.

--full-screen
    Launches the application in full-screen mode by default.

--maximize
    Launches the application with the window maximized by default.

--user-agent string
    Sets a custom user-agent string for the web view, useful for sites that require a specific browser identification.

--internal-urls regex
    A regular expression for URLs that should be kept within the application window. URLs not matching this regex will open in the default system browser.

--disable-dev-tools
    Disables the developer tools (e.g., F12 or Ctrl+Shift+I) within the application, preventing users from inspecting web content.

--tray
    Starts the application minimized to the system tray (where applicable) instead of opening a window.

--single-instance
    Ensures that only a single instance of the application can run at a time. Attempts to launch a second instance will focus the existing one.

--inject path
    Injects a local CSS or JavaScript file into the web page. Useful for custom styling or behavior. Can be specified multiple times.

--electron-version version
    Specifies a particular version of Electron to use for building the application, e.g., '16.0.0'.

--portable
    Creates a portable version of the application that does not require installation and can be run from a USB drive.

--verbose
    Provides more detailed output during the build process, useful for debugging.

--help
    Displays the help message, listing all available options and their usage.

--version
    Prints the installed nativefier version and exits.

DESCRIPTION

nativefier is a powerful command-line tool that allows users to easily convert any web page or web application into a standalone desktop application. It achieves this by leveraging the Electron framework (formerly Atom Shell), which enables the development of desktop GUI applications using web technologies like HTML, CSS, and JavaScript.

The resulting application behaves like a native desktop client, featuring its own dedicated window, icon, and independent process. This is particularly useful for web services that lack official desktop clients, providing a seamless way to access them directly from the desktop without needing a web browser.

nativefier offers extensive customization options, including setting the application's name, icon, default window dimensions, user agent, and rules for internal URL navigation. It supports building cross-platform executables for Linux, macOS, and Windows from a single command, making it a versatile tool for creating tailored desktop experiences from existing web content.

CAVEATS

nativefier requires Node.js and npm to be installed on your system to function. The generated applications can be relatively large in size due to bundling the entire Electron runtime. While providing a native-like experience, some complex web applications might not behave identically as in a standard browser, and performance can vary based on the web content and system resources.

INSTALLATION

nativefier can be easily installed globally via npm (Node Package Manager) using the command:
npm install -g nativefier
Ensure you have Node.js and npm properly set up on your system before attempting installation.

CORE FUNCTIONALITY

At its core, nativefier downloads the specified Electron version, bundles it with your target URL and any custom assets (like icons or injected scripts), and then creates an executable application bundle tailored for your operating system. This package includes everything needed for the web page to run as a standalone desktop application, independent of a web browser installation.

TYPICAL USE CASES

  • Creating dedicated desktop apps for web-based instant messaging services.
  • Wrapping project management tools or internal dashboards for quick access.
  • Providing a 'single-purpose browser' for specific web applications.
  • Turning any web site into a more integrated part of your desktop environment.

HISTORY

Developed and open-sourced by Jia Hao in 2015, nativefier quickly gained popularity as a simple yet effective tool for creating desktop wrappers for web-based services like WhatsApp Web and Slack, often before official desktop clients were widely available or preferred. It's built upon the Electron framework, which was initially released by GitHub as Atom Shell in 2013. The project continues to be actively maintained, adapting to new Electron versions and community contributions.

SEE ALSO

npm(1)

Copied to clipboard