Skip to content

Commit

Permalink
Main window position and size are now persisted through sessions (eth…
Browse files Browse the repository at this point in the history
  • Loading branch information
evertonfraga authored and iquidus committed Feb 22, 2017
1 parent afe2b2d commit 95133f5
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 145 deletions.
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

0 comments on commit 95133f5

Please sign in to comment.