Electron - ArchWiki

Jump to content

# Electron

From ArchWiki

Related articles

- Node.js
- Electron package guidelines

Electron is an application developed by GitHub to build cross platform desktop apps using web technologies. They are rendered using the Chromium browser engine and back end is using the Node.js runtime environment.

## Installation

Install the electron package for the latest version.

Some applications require older electron versions. You can install previous versions in parallel with latest. The corresponding packages are suffixed with version number, for example electron30AUR.

## Tips and tricks

### Configuration files

The `electron` command reads command-line flags from `$XDG_CONFIG_HOME/electronXX-flags.conf` files, where XX is the Electron version, or falls back to `$XDG_CONFIG_HOME/electron-flags.conf` if the former is not present. (`$XDG_CONFIG_HOME` defaults to `~/.config` if not set.)

Note

- These configuration files are only read by the Arch-provided electron; they do not work for packages that bundle their own build of Electron such as slack-desktopAUR. Sometimes alternatives exist such as slack-electronAUR.
- Some applications like vesktopAUR may support setting per-application flags. For such applications, you can create a per-application flags file at `~/.config/application_name-flags.conf` where `application_name` is the name of the app you want to set flags for. For example, to set flags for spotifyAUR, add them inside `~/.config/spotify-flags.conf`.

Lines starting with a hash `#` are treated as comments and ignored, but other lines are passed as CLI arguments to the actual Electron binary, one per line (lines are not split on whitespace!), before the options passed to the `electron` command itself.

This can be useful, for example, to #Enable Wayland globally.

Example:

    ~/.config/electron-flags.conf

    --enable-features=WaylandWindowDecorations,AllowQt
    # --ozone-platform-hint=wayland (removed in Electron 38)
    --ozone-platform=wayland
    # GTK4 works better on Wayland.
    --gtk-version=4

### Determine the version of Electron an application uses

If installed through your package manager, you can query the package's dependencies to see if it depends on e.g. electron38, meaning it uses Electron 38. (If it depends on electron: this package is designed to always provide the latest version of Electron; to learn which version this currently is, query that package's dependencies.)

It is also possible to determine the version of Electron from a running application by using its developer tools; see [1].

### Secret Service API

Electron provides the safestorage API to interact with a keyring compatible with the FreeDesktop.org's Secret Service API. Example of supported keyrings are GNOME/Keyring through GNOME libsecret, KDE Wallet and KeePass.

The backend can be chosen on the command-line with the `--password-store` flag when running an Electron application. As an example, running `electron-desktop` (built with Electron) to interact with `libsecret` or KeePass:

    $ electron-desktop --password-store="gnome-libsecret"

### Turn any website to application

Sometimes you need to use a specific web site, but use it as an application. With webapp-managerAUR you can turn any website to an electron application.

Warning nativefier is deprecated and is not a recommended way to do this anymore! See issue #1577.

### Enable Wayland

See Wayland#Electron.

## Troubleshooting

Since Electron is based on Chromium, Chromium#Troubleshooting may help

Category:

- Frameworks

Electron
Add topic