Search code examples
node.jsmacoselectronmenubar

How to add an icon to the right hand side of the MacOS menu bar in Electron?


I am a fan of the bitbar project that enables you on MacOS to add menu bar items to the right side of the menu bar like this:

enter image description here

Those icons persist even when the focus is on another window and can give the user live information about services running in the background.

I am building some apps with the Electron Framework and was thinking of wrapping bitbar into my applications, but that seems a little bit over engineered.

Is there a way to add an icon to this side of the menu bar? If not: Does anybody know a good example of such an implementation that includes an installer?

Electron's documentation of the Menu bar doe not indicate it. But maybe I overlooked something or there are other implementations of this MacOS only feature?


Solution

  • user No Grabbing pointed me precisely in the right direction! Thank you!

    I was looking with the wrong search parameters: "Tray" seems to be the term i was missing:

    Electron actually does already provide an API for that and after testing it i can say: it works out of the box: https://electronjs.org/docs/api/tray