79558154

Date: 2025-04-06 11:53:42
Score: 2
Natty:
Report link

To set the app icon in MacOS dock, the app.dock.setIcon function.

const nativeImage = require('electron').nativeImage
if (app.dock) {
  const image = nativeImage.createFromPath('icon.png')
  app.dock.setIcon(image);
}

Documentation on the dock, https://www.electronjs.org/docs/latest/api/dock#docksetmenumenu-macos

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Anderson