Electron
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.)
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 nodejs-nativefierAUR you can turn any website to an electron application. For example, there is a website showing you the pressed buttons on the gamepad, and you want to create a separate window for that. Run:
$ nativefier --name gamepad-overlay \ --platform linux --arch x64 \ --width 1024 --height 768 \ --tray --disable-dev-tools \ --single-instance "https://gamepadviewer.com/?p=1&s=4&smeter=1"
Now in your home directory there will be a binary ~/gamepad-overlay-linux-x64/gamepad-overlay
. You can run it and have the gamepad overlay in its own window.
For more options, see the project homepage.
Enable Wayland
See Wayland#Electron.