Skip to content

Commit

Permalink
Preserve window maximized state (#670)
Browse files Browse the repository at this point in the history
* Update package.json

* Update main.js

* Update main.js

* Update package.json

* Update setting.js

* Update setting.js

* Update main.js

* Update main.js
  • Loading branch information
ivysrono authored Mar 22, 2020
1 parent c799653 commit 34c37b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ function newWindow(path) {
window.show()
})

if (setting.get('window.maximized') === true) {
window.maximize()
}

// store the window size
window.on('maximize', () => {
setting.set('window.maximized', true)
})

window.on('unmaximize', () => {
setting.set('window.maximized', false)
})

window.on('closed', () => {
window = null
})
Expand Down
3 changes: 2 additions & 1 deletion src/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ let defaults = {
'window.height': 604,
'window.minheight': 440,
'window.minwidth': 526,
'window.width': 564
'window.width': 564,
'window.maximized': false
}

let eventEmitters = {}
Expand Down

0 comments on commit 34c37b1

Please sign in to comment.