diff options
author | Stefan <stefan@adlk.io> | 2019-02-12 15:40:50 +0100 |
---|---|---|
committer | Stefan <stefan@adlk.io> | 2019-02-12 15:40:50 +0100 |
commit | 952fc8b9b48de1c825c98b996afda5621db5fefe (patch) | |
tree | e4d3e481912af2241cf13b6824c7a088e5291101 /src/index.js | |
parent | Update & reuse electron-rebuild (diff) | |
download | ferdium-app-952fc8b9b48de1c825c98b996afda5621db5fefe.tar.gz ferdium-app-952fc8b9b48de1c825c98b996afda5621db5fefe.tar.zst ferdium-app-952fc8b9b48de1c825c98b996afda5621db5fefe.zip |
feat(Windows): Add option to quit Franz from Taskbar icon
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/index.js b/src/index.js index a3c770797..69cfa77e7 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -33,6 +33,7 @@ import { | |||
33 | DEFAULT_APP_SETTINGS, | 33 | DEFAULT_APP_SETTINGS, |
34 | DEFAULT_WINDOW_OPTIONS, | 34 | DEFAULT_WINDOW_OPTIONS, |
35 | } from './config'; | 35 | } from './config'; |
36 | import { asarPath } from './helpers/asar-helpers'; | ||
36 | /* eslint-enable import/first */ | 37 | /* eslint-enable import/first */ |
37 | 38 | ||
38 | const debug = require('debug')('Franz:App'); | 39 | const debug = require('debug')('Franz:App'); |
@@ -88,6 +89,12 @@ if (!gotTheLock) { | |||
88 | window.setPosition(DEFAULT_WINDOW_OPTIONS.x + 100, DEFAULT_WINDOW_OPTIONS.y + 100); | 89 | window.setPosition(DEFAULT_WINDOW_OPTIONS.x + 100, DEFAULT_WINDOW_OPTIONS.y + 100); |
89 | window.setSize(DEFAULT_WINDOW_OPTIONS.width, DEFAULT_WINDOW_OPTIONS.height); | 90 | window.setSize(DEFAULT_WINDOW_OPTIONS.width, DEFAULT_WINDOW_OPTIONS.height); |
90 | }, 1); | 91 | }, 1); |
92 | } else if (argv.includes('--quit')) { | ||
93 | // Needs to be delayed to not interfere with mainWindow.restore(); | ||
94 | setTimeout(() => { | ||
95 | debug('Quitting Franz via Task'); | ||
96 | app.quit(); | ||
97 | }, 1); | ||
91 | } | 98 | } |
92 | }); | 99 | }); |
93 | } | 100 | } |
@@ -294,10 +301,15 @@ app.on('ready', () => { | |||
294 | app.setUserTasks([{ | 301 | app.setUserTasks([{ |
295 | program: process.execPath, | 302 | program: process.execPath, |
296 | arguments: `${isDevMode ? `${__dirname} ` : ''}--reset-window`, | 303 | arguments: `${isDevMode ? `${__dirname} ` : ''}--reset-window`, |
297 | iconPath: path.join(`${__dirname}`, '../src/assets/images/taskbar/win32/display.ico'), | 304 | iconPath: asarPath(path.join(isDevMode ? `${__dirname}../src/` : __dirname, 'assets/images/taskbar/win32/display.ico')), |
298 | iconIndex: 0, | 305 | iconIndex: 0, |
299 | title: 'Move Franz to Current Display', | 306 | title: 'Move Franz to Current Display', |
300 | description: 'Restore the position and size of Franz', | 307 | description: 'Restore the position and size of Franz', |
308 | }, { | ||
309 | program: process.execPath, | ||
310 | arguments: `${isDevMode ? `${__dirname} ` : ''}--quit`, | ||
311 | iconIndex: 0, | ||
312 | title: 'Quit Franz', | ||
301 | }]); | 313 | }]); |
302 | } | 314 | } |
303 | 315 | ||