1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-24 16:01:20 +01:00

refs #119 Save window state

This commit is contained in:
AkiraFukushima 2018-03-24 23:23:25 +09:00
parent 11e8951e91
commit fc2d872746
3 changed files with 22 additions and 5 deletions

14
package-lock.json generated
View File

@ -3647,8 +3647,7 @@
"deep-equal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
"integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=",
"dev": true
"integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU="
},
"deep-extend": {
"version": "0.4.2",
@ -4465,6 +4464,16 @@
"integrity": "sha1-Dqv3Gp6+qQE/scw1o5DgaGJPJ+g=",
"dev": true
},
"electron-window-state": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/electron-window-state/-/electron-window-state-4.1.1.tgz",
"integrity": "sha1-azT9wxs4UU3+yLfI97XUrdtnYy0=",
"requires": {
"deep-equal": "1.0.1",
"jsonfile": "2.4.0",
"mkdirp": "0.5.1"
}
},
"element-ui": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.2.1.tgz",
@ -8800,7 +8809,6 @@
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
"dev": true,
"requires": {
"graceful-fs": "4.1.11"
}

View File

@ -62,6 +62,7 @@
"dependencies": {
"axios": "^0.18.0",
"electron-log": "^2.2.14",
"electron-window-state": "^4.1.1",
"element-ui": "^2.2.1",
"google-fonts-webpack-plugin": "^0.4.4",
"is-empty": "^1.2.0",

View File

@ -4,6 +4,7 @@ import { app, ipcMain, BrowserWindow, shell, Menu } from 'electron'
import Datastore from 'nedb'
import empty from 'is-empty'
import log from 'electron-log'
import windowStateKeeper from 'electron-window-state'
import Authentication from './auth'
import Account from './account'
@ -170,13 +171,20 @@ function createWindow () {
/**
* Initial window options
*/
let mainWindowState = windowStateKeeper({
defaultWidth: 1000,
height: 563
})
mainWindow = new BrowserWindow({
titleBarStyle: 'hidden',
height: 563,
x: mainWindowState.x,
y: mainWindowState.y,
width: mainWindowState.width,
height: mainWindowState.height,
useContentSize: true,
width: 1000,
icon: require('path').join(__dirname, '../../build/icons/256x256.png')
})
mainWindowState.manage(mainWindow)
mainWindow.loadURL(winURL)