Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
Remember screen position
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Rupp authored and Matthias Rupp committed Sep 1, 2017
1 parent f4ce202 commit 05d5572
Show file tree
Hide file tree
Showing 2 changed files with 1,981 additions and 4 deletions.
16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ function createWindow () {

if (data.save_dimensions && data.width && data.height) {
browserWindow.setContentSize(data.width, data.height, false)
if (data.xpos && data.ypos) {
browserWindow.setPosition(data.xpos, data.ypos)
}
}

load('index.html')
Expand All @@ -53,12 +56,17 @@ function createWindow () {
})

browserWindow.on('close', () => {
let width = browserWindow.getBounds().width
let height = browserWindow.getBounds().height

let w = browserWindow.getBounds().width
let h = browserWindow.getBounds().height
let x = browserWindow.getPosition()[0]
let y = browserWindow.getPosition()[1]

storage.get('config', (err, data) => {
data.width = width
data.height = height
data.width = w
data.height = h
data.xpos = x
data.ypos = y
storage.set('config', data)
})
})
Expand Down
Loading

0 comments on commit 05d5572

Please sign in to comment.