Electron Documentation

Docs / Guides / Progress Bar in Taskbar (Windows, macOS, Unity) electron@master (f4d0ce)

Progress Bar in Taskbar (Windows, macOS, Unity)

On Windows a taskbar button can be used to display a progress bar. This enables a window to provide progress information to the user without the user having to switch to the window itself.

On macOS the progress bar will be displayed as a part of the dock icon.

The Unity DE also has a similar feature that allows you to specify the progress bar in the launcher.

Progress bar in taskbar button:

Taskbar Progress Bar

All three cases are covered by the same API - the setProgressBar() method available on instances of BrowserWindows. Call it with a number between 0 and 1 to indicate your progress. If you have a long-running task that's currently at 63% towards completion, you'd call it with setProgressBar(0.63).

Generally speaking, setting the parameter to a value below zero (like -1) will remove the progress bar while setting it to a value higher than one (like 2) will switch the progress bar to intermediate mode.

See the API documentation for more options and modes.

const { BrowserWindow } = require('electron')
  const win = new BrowserWindow()