Skip to content

Commit

Permalink
3.13.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Maigo Erit committed May 13, 2020
1 parent 2fe3f09 commit 61432d4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion electron/app/app-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class AppUpdater {
AppUpdater.dialogIsOpen = true;

if (!WindowManager.mainWindow) {
WindowManager.setMainWindow();
WindowManager.setMainWindow(false);
}

const { response } = await dialog.showMessageBox(WindowManager.mainWindow, {
Expand Down
18 changes: 12 additions & 6 deletions electron/app/window-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ export default class WindowManager {
menuBuilder.buildMenu();
}

static setMainWindow() {
static createMainWindow() {
logger.debug('Creating main window.');
const windowSize = config.persisted.get('windowsize') || { width: 1080, height: 720 };
const openMaximized = config.persisted.get('openMaximized') || false;

this.mainWindow = new BrowserWindow({
width: windowSize.width,
Expand All @@ -45,13 +44,18 @@ export default class WindowManager {
title: 'Tockler',
icon: config.iconBig,
});
}

static setMainWindow(showOnLoad = true) {
WindowManager.createMainWindow();
const openMaximized = config.persisted.get('openMaximized') || false;

if (app.dock) {
if (app.dock && showOnLoad) {
logger.debug('Show dock window.');
app.dock.show();
}

if (openMaximized) {
if (openMaximized && showOnLoad) {
this.mainWindow.maximize();
}

Expand All @@ -72,8 +76,10 @@ export default class WindowManager {

this.mainWindow.webContents.on('did-finish-load', () => {
logger.debug('did-finish-load');
this.mainWindow.show();
this.mainWindow.focus();
if (showOnLoad) {
this.mainWindow.show();
this.mainWindow.focus();
}
});

this.mainWindow.on('close', () => {
Expand Down
2 changes: 1 addition & 1 deletion electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tockler",
"version": "3.13.19",
"version": "3.13.20",
"description": "Automatically track applications usage and working time",
"author": "Maigo Erit <[email protected]>",
"license": "GPL-2.0",
Expand Down

0 comments on commit 61432d4

Please sign in to comment.