Browse Source

Merge pull request #751 from gre/fix-default-window-size

Use a default window size different from the minimum window size
master
Meriadec Pillet 7 years ago
committed by GitHub
parent
commit
6fabdcfa70
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/config/constants.js
  2. 11
      src/main/app.js

4
src/config/constants.js

@ -15,8 +15,10 @@ const stringFromEnv = (key: string, def: string): string => process.env[key] ||
// Size
export const MIN_HEIGHT = intFromEnv('LEDGER_MIN_HEIGHT', 700)
export const DEFAULT_WINDOW_WIDTH = intFromEnv('LEDGER_DEFAULT_WINDOW_WIDTH', 1024)
export const DEFAULT_WINDOW_HEIGHT = intFromEnv('LEDGER_DEFAULT_WINDOW_HEIGHT', 768)
export const MIN_WIDTH = intFromEnv('LEDGER_MIN_WIDTH', 1024)
export const MIN_HEIGHT = intFromEnv('LEDGER_MIN_HEIGHT', 700)
// time and delays...

11
src/main/app.js

@ -2,7 +2,12 @@
import { app, BrowserWindow, Menu, screen } from 'electron'
import debounce from 'lodash/debounce'
import { MIN_HEIGHT, MIN_WIDTH } from 'config/constants'
import {
MIN_HEIGHT,
MIN_WIDTH,
DEFAULT_WINDOW_WIDTH,
DEFAULT_WINDOW_HEIGHT,
} from 'config/constants'
import menu from 'main/menu'
import db from 'helpers/db'
@ -77,8 +82,8 @@ function createMainWindow() {
const savedDimensions = db.getIn('settings', 'window.MainWindow.dimensions', {})
const savedPositions = db.getIn('settings', 'window.MainWindow.positions', null)
const width = savedDimensions.width || MIN_WIDTH
const height = savedDimensions.height || MIN_HEIGHT
const width = savedDimensions.width || DEFAULT_WINDOW_WIDTH
const height = savedDimensions.height || DEFAULT_WINDOW_HEIGHT
const windowOptions = {
...defaultWindowOptions,

Loading…
Cancel
Save