From 952fc8b9b48de1c825c98b996afda5621db5fefe Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 12 Feb 2019 15:40:50 +0100 Subject: feat(Windows): Add option to quit Franz from Taskbar icon --- src/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/index.js') 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 { DEFAULT_APP_SETTINGS, DEFAULT_WINDOW_OPTIONS, } from './config'; +import { asarPath } from './helpers/asar-helpers'; /* eslint-enable import/first */ const debug = require('debug')('Franz:App'); @@ -88,6 +89,12 @@ if (!gotTheLock) { window.setPosition(DEFAULT_WINDOW_OPTIONS.x + 100, DEFAULT_WINDOW_OPTIONS.y + 100); window.setSize(DEFAULT_WINDOW_OPTIONS.width, DEFAULT_WINDOW_OPTIONS.height); }, 1); + } else if (argv.includes('--quit')) { + // Needs to be delayed to not interfere with mainWindow.restore(); + setTimeout(() => { + debug('Quitting Franz via Task'); + app.quit(); + }, 1); } }); } @@ -294,10 +301,15 @@ app.on('ready', () => { app.setUserTasks([{ program: process.execPath, arguments: `${isDevMode ? `${__dirname} ` : ''}--reset-window`, - iconPath: path.join(`${__dirname}`, '../src/assets/images/taskbar/win32/display.ico'), + iconPath: asarPath(path.join(isDevMode ? `${__dirname}../src/` : __dirname, 'assets/images/taskbar/win32/display.ico')), iconIndex: 0, title: 'Move Franz to Current Display', description: 'Restore the position and size of Franz', + }, { + program: process.execPath, + arguments: `${isDevMode ? `${__dirname} ` : ''}--quit`, + iconIndex: 0, + title: 'Quit Franz', }]); } -- cgit v1.2.3-70-g09d2