Skip to content
This repository was archived by the owner on Sep 5, 2020. It is now read-only.

Persisting main window bounds #1641

Merged
merged 2 commits into from
Feb 17, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
21 changes: 17 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ClientBinaryManager = require('./modules/clientBinaryManager');
const UpdateChecker = require('./modules/updateChecker');
const Settings = require('./modules/settings');
const Q = require('bluebird');
const windowStateKeeper = require('electron-window-state');

Q.config({
cancellation: true,
Expand Down Expand Up @@ -191,13 +192,20 @@ onReady = () => {

// Create the browser window.

const defaultWindow = windowStateKeeper({
defaultWidth: 1024 + 208,
defaultHeight: 720
});

// MIST
if (Settings.uiMode === 'mist') {
mainWindow = Windows.create('main', {
primary: true,
electronOptions: {
width: 1024 + 208,
height: 720,
width: Math.max(defaultWindow.width, 500),
height: Math.max(defaultWindow.height, 440),
x: defaultWindow.x,
y: defaultWindow.y,
webPreferences: {
nodeIntegration: true, /* necessary for webviews;
require will be removed through preloader */
Expand All @@ -213,8 +221,10 @@ onReady = () => {
mainWindow = Windows.create('main', {
primary: true,
electronOptions: {
width: 1100,
height: 720,
width: Math.max(defaultWindow.width, 500),
height: Math.max(defaultWindow.height, 440),
x: defaultWindow.x,
y: defaultWindow.y,
webPreferences: {
preload: `${__dirname}/modules/preloader/walletMain.js`,
'overlay-fullscreen-video': true,
Expand All @@ -224,6 +234,9 @@ onReady = () => {
});
}

// Delegating events to save window bounds on windowStateKeeper
defaultWindow.manage(mainWindow.window);

if (!Settings.inAutoTestMode) {
splashWindow = Windows.create('splash', {
primary: true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"chai-as-promised": "^6.0.0",
"chai-string": "^1.3.0",
"electron-squirrel-startup": "^1.0.0",
"electron-window-state": "^4.0.1",
"ethereum-client-binaries": "^1.6.1",
"ethereum-keyfile-recognizer": "^1.0.2",
"ethereumjs-abi": "^0.6.3",
Expand Down
Loading