index.jsView |
---|
7 | 7 | var openWindow = require('./lib/window') |
8 | 8 | |
9 | 9 | var Path = require('path') |
10 | 10 | var defaultMenu = require('electron-default-menu') |
| 11 | +var WindowState = require('electron-window-state') |
11 | 12 | var Menu = electron.Menu |
12 | 13 | var extend = require('xtend') |
13 | 14 | var ssbKeys = require('ssb-keys') |
14 | 15 | |
15 | 16 | var windows = { |
16 | 17 | dialogs: new Set() |
17 | 18 | } |
18 | | - |
19 | 19 | var ssbConfig = null |
20 | 20 | |
21 | 21 | electron.app.on('ready', () => { |
22 | 22 | setupContext('ssb', { |
50 | 50 | }) |
51 | 51 | |
52 | 52 | function openMainWindow () { |
53 | 53 | if (!windows.main) { |
| 54 | + var windowState = WindowState({ |
| 55 | + defaultWidth: 1024, |
| 56 | + defaultHeight: 768 |
| 57 | + }) |
54 | 58 | windows.main = openWindow(ssbConfig, Path.join(__dirname, 'main-window.js'), { |
55 | 59 | minWidth: 800, |
56 | | - width: 1024, |
57 | | - height: 768, |
| 60 | + x: windowState.x, |
| 61 | + y: windowState.y, |
| 62 | + width: windowState.width, |
| 63 | + height: windowState.height, |
58 | 64 | titleBarStyle: 'hidden-inset', |
59 | 65 | autoHideMenuBar: true, |
60 | 66 | title: 'Patchwork', |
61 | 67 | show: true, |
64 | 70 | experimentalFeatures: true |
65 | 71 | }, |
66 | 72 | icon: './assets/icon.png' |
67 | 73 | }) |
| 74 | + windowState.manage(windows.main) |
68 | 75 | windows.main.setSheetOffset(40) |
69 | 76 | windows.main.on('closed', function () { |
70 | 77 | windows.main = null |
71 | 78 | if (process.platform !== 'darwin') electron.app.quit() |