Helps positioning your electron windows.
npm install --save electron-positioner
var Positioner = require('electron-positioner')
var positioner = new Positioner(browserWindow)
// Moves the window top right on the screen.
positioner.move('topRight')
// Returns `{x,y}`
positioner.calculate('trayCenter', trayBounds)
Note, trayBounds
is only required with the positions that starts with tray
.
Constructor
The BrowserWindow instance.
Returns coordinates {x,y}
.
Moves the window with BrowserWindow.setPosition()
A string telling where to place the window. Allowed values:
trayLeft
trayBottomLeft
trayRight
trayBottomRight
trayCenter
trayBottomCenter
topLeft
topRight
bottomLeft
bottomRight
topCenter
bottomCenter
leftCenter
rightCenter
center
Tray bounds, only needed for the following positions:
trayLeft
trayBottomLeft
trayRight
trayBottomRight
trayCenter
trayBottomCenter
npm test
MIT