Skip to content

tex0l/electron-positioner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Electron-positioner Build Status js-standard-style

Helps positioning your electron windows.

Install

npm install --save electron-positioner

Usage

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`.

Docs

new Positioner (browserWindow)

Constructor

browserWindow

The browser-window instance.

calculate (position, trayBounds)

Returns coordinates {x,y}.

move (position, trayBounds)

Moves the window with browserWindow.setPosition()

position

A string telling where to place the window. Allowed values:

  • trayLeft
  • trayBottomLeft
  • trayRight
  • trayBottomRight
  • trayCenter
  • trayBottomCenter
  • topLeft
  • topRight
  • bottomLeft
  • bottomRight
  • topCenter
  • bottomCenter
  • center
trayBounds

Tray bounds, only needed for the following positions:

  • trayLeft
  • trayBottomLeft
  • trayRight
  • trayBottomRight
  • trayCenter
  • trayBottomCenter

Tests

npm test

License

MIT

About

Helps positioning your electron windows.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%