Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve window maximized state #670

Merged
merged 8 commits into from
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ 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('resize', () => {
setting.set('window.width', window.getSize()[0])
ivysrono marked this conversation as resolved.
Show resolved Hide resolved
setting.set('window.height', window.getSize()[1])
})

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 @@ -210,7 +210,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