WIP: fix: write position of window

This commit is contained in:
Cutls 2019-10-03 01:38:21 +09:00
parent 8117ddb6ce
commit 02f49cd392

View File

@ -204,6 +204,7 @@ function createWindow() {
}); });
closeArg = false closeArg = false
mainWindow.on('close', function (e, arg) { mainWindow.on('close', function (e, arg) {
writePos(mainWindow)
if(!closeArg){ if(!closeArg){
e.preventDefault() e.preventDefault()
} }
@ -212,7 +213,6 @@ function createWindow() {
setTimeout(function () { resolve() }, 3000) setTimeout(function () { resolve() }, 3000)
}) })
promise.then((function (response) { promise.then((function (response) {
writePos(mainWindow)
closeArg = true closeArg = true
mainWindow.close() mainWindow.close()
}) })
@ -236,9 +236,11 @@ function createWindow() {
fs.writeFileSync(info_path, JSON.stringify(size)) fs.writeFileSync(info_path, JSON.stringify(size))
} }
mainWindow.on('maximize', function () { mainWindow.on('maximize', function () {
writePos(mainWindow)
fs.writeFileSync(max_info_path, JSON.stringify(mainWindow.getBounds())); fs.writeFileSync(max_info_path, JSON.stringify(mainWindow.getBounds()));
}); });
mainWindow.on('minimize', function () { mainWindow.on('minimize', function () {
writePos(mainWindow)
mainWindow.webContents.send('asRead', "") mainWindow.webContents.send('asRead', "")
}) })