Need help with electron-positioner?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

jenslind
223 Stars 21 Forks 62 Commits 3 Opened issues

Description

:pushpin: Helps positioning your electron windows.

Services available

!
?

Need anything else?

Contributors list

# 449,346
JavaScr...
Electro...
11 commits
# 20,800
JavaScr...
outlook
trello
gmail
2 commits
# 36,833
phantom...
Electro...
CSS
yarn
1 commit
# 19,225
Redux
nsis
Electro...
Deno
1 commit
# 31,693
Clojure
Shell
React N...
Go
1 commit

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 BrowserWindow 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
-
leftCenter
-
rightCenter
-
center
trayBounds

Tray bounds, only needed for the following positions: -

trayLeft
-
trayBottomLeft
-
trayRight
-
trayBottomRight
-
trayCenter
-
trayBottomCenter

Tests

npm test

License

MIT

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.