aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/index.js b/src/index.js
index 030736fee..a72d76f3a 100644
--- a/src/index.js
+++ b/src/index.js
@@ -2,18 +2,14 @@ import { app, BrowserWindow, shell } from 'electron';
2import fs from 'fs-extra'; 2import fs from 'fs-extra';
3import path from 'path'; 3import path from 'path';
4 4
5/* eslint-disable */
6if (require('electron-squirrel-startup')) app.quit();
7
8import windowStateKeeper from 'electron-window-state'; 5import windowStateKeeper from 'electron-window-state';
9 6
10import { isDevMode, isWindows } from './environment'; 7import { isDevMode, isWindows } from './environment';
11import ipcApi from './electron/ipc-api'; 8import ipcApi from './electron/ipc-api';
12import Tray from './lib/Tray'; 9import Tray from './lib/Tray';
13import Settings from './electron/Settings'; 10import Settings from './electron/Settings';
14import { appId } from './package.json'; 11import { appId } from './package.json'; // eslint-disable-line import/no-unresolved
15import './electron/exception'; 12import './electron/exception';
16/* eslint-enable */
17 13
18// Keep a global reference of the window object, if you don't, the window will 14// Keep a global reference of the window object, if you don't, the window will
19// be closed automatically when the JavaScript object is garbage collected. 15// be closed automatically when the JavaScript object is garbage collected.
@@ -114,6 +110,13 @@ const createWindow = async () => {
114 app.isMaximized = true; 110 app.isMaximized = true;
115 }); 111 });
116 112
113 mainWindow.on('close', (e) => {
114 if (settings.get('minimizeToSystemTray')) {
115 e.preventDefault();
116 mainWindow.minimize();
117 }
118 });
119
117 mainWindow.on('unmaximize', () => { 120 mainWindow.on('unmaximize', () => {
118 app.isMaximized = false; 121 app.isMaximized = false;
119 }); 122 });