This commit is contained in:
leejinho 2020-02-06 18:43:25 +09:00
commit 94b714871a
3 changed files with 11 additions and 4 deletions

View File

@ -5,7 +5,6 @@ import { app, BrowserWindow, screen, ipcMain, IpcMainEvent } from 'electron';
import windowStateKeeper from 'electron-window-state'; import windowStateKeeper from 'electron-window-state';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { now } from '../util/now';
import { registerWindowStateChangedEvents } from '../lib/window-state'; import { registerWindowStateChangedEvents } from '../lib/window-state';
import { import {
ElectronAppChannel, ElectronAppChannel,
@ -13,6 +12,9 @@ import {
ElectronWebContentsChannel ElectronWebContentsChannel
} from '@ucap-webmessenger/electron-core'; } from '@ucap-webmessenger/electron-core';
import { appStorage } from '../lib/storage';
import { now } from '../util/now';
export class AppWindow { export class AppWindow {
private window: BrowserWindow | null = null; private window: BrowserWindow | null = null;
@ -55,7 +57,8 @@ export class AppWindow {
nodeIntegration: true nodeIntegration: true
}, },
acceptFirstMouse: true, acceptFirstMouse: true,
icon: this.appIconPath icon: this.appIconPath,
show: false
}; };
if (__DARWIN__) { if (__DARWIN__) {
@ -117,6 +120,9 @@ export class AppWindow {
// can be tidied up once https://github.com/electron/electron/issues/12971 // can be tidied up once https://github.com/electron/electron/issues/12971
// has been confirmed as resolved // has been confirmed as resolved
this.window.once(ElectronBrowserWindowChannel.ReadyToShow, () => { this.window.once(ElectronBrowserWindowChannel.ReadyToShow, () => {
if (!appStorage.startupHideWindow) {
this.window.show();
}
this.window.on(ElectronBrowserWindowChannel.Unmaximize, () => { this.window.on(ElectronBrowserWindowChannel.Unmaximize, () => {
setTimeout(() => { setTimeout(() => {
const bounds = this.window.getBounds(); const bounds = this.window.getBounds();

View File

@ -55,7 +55,7 @@ import {
import log from 'electron-log'; import log from 'electron-log';
import { RendererUpdater } from './lib/renderer-updater'; import { RendererUpdater } from './lib/renderer-updater';
import { Storage } from './lib/storage'; import { appStorage } from './lib/storage';
const appIconPath = __LINUX__ const appIconPath = __LINUX__
? __DEV__ ? __DEV__
@ -88,7 +88,6 @@ let preventQuit = false;
let notificationService: ElectronNotificationService | null; let notificationService: ElectronNotificationService | null;
let updateWindowService: ElectronUpdateWindowService | null; let updateWindowService: ElectronUpdateWindowService | null;
const appStorage: Storage = new Storage();
function handleUncaughtException(error: Error) { function handleUncaughtException(error: Error) {
preventQuit = true; preventQuit = true;

View File

@ -45,3 +45,5 @@ export class Storage {
this.store.set(STORE_KEY_DOWNLOADFOLDER, downloadPath); this.store.set(STORE_KEY_DOWNLOADFOLDER, downloadPath);
} }
} }
export const appStorage: Storage = new Storage();