Skip to content
This repository has been archived by the owner on Jun 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #21 from mskims/make-playerwindow-resizable
Browse files Browse the repository at this point in the history
Remember player size
  • Loading branch information
mskims authored Jul 23, 2018
2 parents 19d5aea + b3d7c87 commit 84dcc2a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/windows/player/index.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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', () => {
Expand Down

0 comments on commit 84dcc2a

Please sign in to comment.