diff options
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 34 |
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'; | |||
8 | import ipcApi from './electron/ipc-api'; | 8 | import ipcApi from './electron/ipc-api'; |
9 | import Tray from './lib/Tray'; | 9 | import Tray from './lib/Tray'; |
10 | import Settings from './electron/Settings'; | 10 | import Settings from './electron/Settings'; |
11 | import handleDeepLink from './electron/deepLinking'; | ||
11 | import { appId } from './package.json'; // eslint-disable-line import/no-unresolved | 12 | import { appId } from './package.json'; // eslint-disable-line import/no-unresolved |
12 | import './electron/exception'; | 13 | import './electron/exception'; |
13 | 14 | ||
@@ -26,10 +27,19 @@ if (isWindows) { | |||
26 | } | 27 | } |
27 | 28 | ||
28 | // Force single window | 29 | // Force single window |
29 | const isSecondInstance = app.makeSingleInstance(() => { | 30 | const 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 |
42 | app.disableHardwareAcceleration(); | 52 | |
53 | // Disabled to test tweetdeck glitches | ||
54 | // app.disableHardwareAcceleration(); | ||
43 | 55 | ||
44 | // Initialize Settings | 56 | // Initialize Settings |
45 | const settings = new Settings(); | 57 | const settings = new Settings(); |
46 | 58 | ||
47 | const createWindow = async () => { | 59 | const 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 | |||
190 | app.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 | ||
200 | app.setAsDefaultProtocolClient('franz'); | ||