aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/index.js b/src/index.js
index efb3be737..a047e2bc1 100644
--- a/src/index.js
+++ b/src/index.js
@@ -8,6 +8,7 @@ import { isDevMode, isWindows } from './environment';
8import ipcApi from './electron/ipc-api'; 8import ipcApi from './electron/ipc-api';
9import Tray from './lib/Tray'; 9import Tray from './lib/Tray';
10import Settings from './electron/Settings'; 10import Settings from './electron/Settings';
11import handleDeepLink from './electron/deepLinking';
11import { appId } from './package.json'; // eslint-disable-line import/no-unresolved 12import { appId } from './package.json'; // eslint-disable-line import/no-unresolved
12import './electron/exception'; 13import './electron/exception';
13 14
@@ -26,10 +27,19 @@ if (isWindows) {
26} 27}
27 28
28// Force single window 29// Force single window
29const isSecondInstance = app.makeSingleInstance(() => { 30const isSecondInstance = app.makeSingleInstance((argv) => {
30 if (mainWindow) { 31 if (mainWindow) {
31 if (mainWindow.isMinimized()) mainWindow.restore(); 32 if (mainWindow.isMinimized()) mainWindow.restore();
32 mainWindow.focus(); 33 mainWindow.focus();
34
35 if (process.platform === 'win32') {
36 // Keep only command line / deep linked arguments
37 const url = argv.slice(1);
38
39 if (url) {
40 handleDeepLink(mainWindow, url.toString());
41 }
42 }
33 } 43 }
34}); 44});
35 45
@@ -39,12 +49,14 @@ if (isSecondInstance) {
39 49
40// Lets disable Hardware Acceleration until we have a better solution 50// Lets disable Hardware Acceleration until we have a better solution
41// to deal with the high-perf-gpu requirement of some services 51// to deal with the high-perf-gpu requirement of some services
42app.disableHardwareAcceleration(); 52
53// Disabled to test tweetdeck glitches
54// app.disableHardwareAcceleration();
43 55
44// Initialize Settings 56// Initialize Settings
45const settings = new Settings(); 57const settings = new Settings();
46 58
47const createWindow = async () => { 59const createWindow = () => {
48 // Remember window size 60 // Remember window size
49 const mainWindowState = windowStateKeeper({ 61 const mainWindowState = windowStateKeeper({
50 defaultWidth: 800, 62 defaultWidth: 800,
@@ -57,8 +69,8 @@ const createWindow = async () => {
57 y: mainWindowState.y, 69 y: mainWindowState.y,
58 width: mainWindowState.width, 70 width: mainWindowState.width,
59 height: mainWindowState.height, 71 height: mainWindowState.height,
60 minWidth: 800, 72 minWidth: 600,
61 minHeight: 600, 73 minHeight: 500,
62 titleBarStyle: 'hidden', 74 titleBarStyle: 'hidden',
63 backgroundColor: '#3498db', 75 backgroundColor: '#3498db',
64 autoHideMenuBar: true, 76 autoHideMenuBar: true,
@@ -174,3 +186,15 @@ app.on('activate', () => {
174 mainWindow.show(); 186 mainWindow.show();
175 } 187 }
176}); 188});
189
190app.on('will-finish-launching', () => {
191 // Protocol handler for osx
192 app.on('open-url', (event, url) => {
193 event.preventDefault();
194 console.log(`open-url event: ${url}`);
195 handleDeepLink(mainWindow, url);
196 });
197});
198
199// Register App URL
200app.setAsDefaultProtocolClient('franz');