⚠️ Package no longer maintained. Please contact me if you want to become its maintainer.
This lets you create a menubar very easily with Electron.
npm install --save electron-menubar
options
Object (optional)icon
String. The tray's icon. Defaults toapp.getAppPath()/icon.png
.index
String. The index file for the window. Defaults toapp.getAppPath()/index.html
.preloadWindow
Boolean. Tells if the window must be preloaded. Defaults tofalse
.showDockIcon
Boolean. Default isfalse
.showOnRightClick
Boolean. Default isfalse
.showOnAllWorkspaces
Boolean. Default isfalse
.tooltip
String. The tray's tooltip.
menubar.isReady()
tells if the menubar is already ready.menubar.hide()
hides the window.menubar.show()
shows the window.
ready
create-window
after-create-window
hide
after-hide
show
after-show
Positioner.getTaskbarPosition()
returns the position of the taskbar:top|right|bottom|left
.Positioner.position(window, trayBounds, [alignment])
positions the window in a certain place.window
BrowserWindow. Is the window to position.trayBounds
Rectangle. Are the bounds from the Electron.Tray.alignment
Object. Are the positions to position the window.alignment.x
String. Defaults tocenter
. Can beleft|center|right
.alignment.y
String. Defaults tocenter
. Can beup|center|down
.
Positioner.calculate(windowBounds, trayBounds, [alignment])
only calculates the position and returns an Object{x: n, y: k}
.windowBounds
Rectangle. A BrowserWindow bounds.trayBounds
Rectangle. Are the bounds from the Electron.Tray.alignment
Object. Are the positions to position the window.alignment.x
String. Defaults tocenter
. Can beleft|center|right
.alignment.y
String. Defaults tocenter
. Can beup|center|down
.
The code of this project is mainly based on menubar
and electron-traywindow-positioner
with some improvements and cleaning.