git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit 02c37f2952d1e4ff2fea0f375f266d29e1b8c915

window: enable main window to remember size and position

Lars-Magnus Skog committed on 3/26/2017, 2:47:37 PM
Parent: 79a7648a67be6e62f470c97d30dd7256f2e7edea

Files changed

index.jschanged
package.jsonchanged
index.jsView
@@ -7,16 +7,16 @@
77 var openWindow = require('./lib/window')
88
99 var Path = require('path')
1010 var defaultMenu = require('electron-default-menu')
11+var WindowState = require('electron-window-state')
1112 var Menu = electron.Menu
1213 var extend = require('xtend')
1314 var ssbKeys = require('ssb-keys')
1415
1516 var windows = {
1617 dialogs: new Set()
1718 }
18-
1919 var ssbConfig = null
2020
2121 electron.app.on('ready', () => {
2222 setupContext('ssb', {
@@ -50,12 +50,18 @@
5050 })
5151
5252 function openMainWindow () {
5353 if (!windows.main) {
54+ var windowState = WindowState({
55+ defaultWidth: 1024,
56+ defaultHeight: 768
57+ })
5458 windows.main = openWindow(ssbConfig, Path.join(__dirname, 'main-window.js'), {
5559 minWidth: 800,
56- width: 1024,
57- height: 768,
60+ x: windowState.x,
61+ y: windowState.y,
62+ width: windowState.width,
63+ height: windowState.height,
5864 titleBarStyle: 'hidden-inset',
5965 autoHideMenuBar: true,
6066 title: 'Patchwork',
6167 show: true,
@@ -64,8 +70,9 @@
6470 experimentalFeatures: true
6571 },
6672 icon: './assets/icon.png'
6773 })
74+ windowState.manage(windows.main)
6875 windows.main.setSheetOffset(40)
6976 windows.main.on('closed', function () {
7077 windows.main = null
7178 if (process.platform !== 'darwin') electron.app.quit()
package.jsonView
@@ -22,8 +22,9 @@
2222 "depject": "^3.2.0",
2323 "depnest": "^1.0.2",
2424 "electron-default-menu": "~1.0.0",
2525 "electron-spellchecker": "^1.0.4",
26+ "electron-window-state": "^4.1.0",
2627 "graphmitter": "^1.6.3",
2728 "has-network": "0.0.0",
2829 "insert-css": "~1.0.0",
2930 "is-visible": "^2.1.1",

Built with git-ssb-web