From b3d7c87d6ac705ecc8c15e756e0be9cd41d3f5fc Mon Sep 17 00:00:00 2001 From: MinSeok Kim Date: Tue, 24 Jul 2018 01:18:40 +0900 Subject: [PATCH] Remember player size --- src/windows/player/index.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/windows/player/index.js b/src/windows/player/index.js index 038d464..51a9a74 100644 --- a/src/windows/player/index.js +++ b/src/windows/player/index.js @@ -1,13 +1,19 @@ import { BrowserWindow } from 'electron' import { TrayManager, WindowManager } from '../../main/common' +import * as constants from '../../main/constants' import { debounce } from 'throttle-debounce' +import settings from 'electron-settings' import path from 'path' -import * as constants from '../../main/constants' export const create = () => { + const initialPlayerWindowBounds = settings.get('playerWindowSize', { + width: 450, + height: 500 + }) + const playerWindow = new BrowserWindow({ - width: 450, - height: 500, + width: initialPlayerWindowBounds.width, + height: initialPlayerWindowBounds.height, show: false, frame: false, fullscreenable: false, @@ -24,6 +30,12 @@ export const create = () => { const tray = TrayManager.get('main') fitWindowSizeOnTray(playerWindow, tray) + + const playerWindowBounds = playerWindow.getBounds() + settings.set('playerWindowSize', { + width: playerWindowBounds.width, + height: playerWindowBounds.height + }) })) playerWindow.on('blur', () => {