aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/index.js b/src/index.js
index 7de7a5e1c..2ee404c0b 100644
--- a/src/index.js
+++ b/src/index.js
@@ -10,8 +10,13 @@ import path from 'path';
10import windowStateKeeper from 'electron-window-state'; 10import windowStateKeeper from 'electron-window-state';
11 11
12// Set app directory before loading user modules 12// Set app directory before loading user modules
13if (process.env.FERDI_APPDATA_DIR != null) {
14 app.setPath('appData', process.env.FERDI_APPDATA_DIR);
15} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
16 app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR);
17}
13if (isDevMode) { 18if (isDevMode) {
14 app.setPath('userData', path.join(app.getPath('appData'), 'FranzDev')); 19 app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}Dev`));
15} 20}
16 21
17/* eslint-disable import/first */ 22/* eslint-disable import/first */
@@ -37,7 +42,7 @@ import { asarPath } from './helpers/asar-helpers';
37import { isValidExternalURL } from './helpers/url-helpers'; 42import { isValidExternalURL } from './helpers/url-helpers';
38/* eslint-enable import/first */ 43/* eslint-enable import/first */
39 44
40const debug = require('debug')('Franz:App'); 45const debug = require('debug')('Ferdi:App');
41 46
42// Keep a global reference of the window object, if you don't, the window will 47// Keep a global reference of the window object, if you don't, the window will
43// be closed automatically when the JavaScript object is garbage collected. 48// be closed automatically when the JavaScript object is garbage collected.
@@ -96,7 +101,7 @@ if (!gotTheLock) {
96 } else if (argv.includes('--quit')) { 101 } else if (argv.includes('--quit')) {
97 // Needs to be delayed to not interfere with mainWindow.restore(); 102 // Needs to be delayed to not interfere with mainWindow.restore();
98 setTimeout(() => { 103 setTimeout(() => {
99 debug('Quitting Franz via Task'); 104 debug('Quitting Ferdi via Task');
100 app.quit(); 105 app.quit();
101 }, 1); 106 }, 1);
102 } 107 }
@@ -148,7 +153,7 @@ const createWindow = () => {
148 minHeight: 500, 153 minHeight: 500,
149 titleBarStyle: isMac ? 'hidden' : '', 154 titleBarStyle: isMac ? 'hidden' : '',
150 frame: isLinux, 155 frame: isLinux,
151 backgroundColor: !settings.get('darkMode') ? '#3498db' : '#1E1E1E', 156 backgroundColor: !settings.get('darkMode') ? '#7367F0' : '#1E1E1E',
152 webPreferences: { 157 webPreferences: {
153 nodeIntegration: true, 158 nodeIntegration: true,
154 webviewTag: true, 159 webviewTag: true,
@@ -158,7 +163,7 @@ const createWindow = () => {
158 mainWindow.webContents.on('did-finish-load', () => { 163 mainWindow.webContents.on('did-finish-load', () => {
159 const fns = onDidLoadFns; 164 const fns = onDidLoadFns;
160 onDidLoadFns = null; 165 onDidLoadFns = null;
161 for (const fn of fns) { 166 for (const fn of fns) { // eslint-disable-line no-unused-vars
162 fn(mainWindow); 167 fn(mainWindow);
163 } 168 }
164 }); 169 });
@@ -281,7 +286,7 @@ const createWindow = () => {
281// https://electronjs.org/docs/api/chrome-command-line-switches 286// https://electronjs.org/docs/api/chrome-command-line-switches
282// used for Kerberos support 287// used for Kerberos support
283// Usage e.g. MACOS 288// Usage e.g. MACOS
284// $ Franz.app/Contents/MacOS/Franz --auth-server-whitelist *.mydomain.com --auth-negotiate-delegate-whitelist *.mydomain.com 289// $ Franz.app/Contents/MacOS/Ferdi --auth-server-whitelist *.mydomain.com --auth-negotiate-delegate-whitelist *.mydomain.com
285const argv = require('minimist')(process.argv.slice(1)); 290const argv = require('minimist')(process.argv.slice(1));
286 291
287if (argv['auth-server-whitelist']) { 292if (argv['auth-server-whitelist']) {
@@ -296,10 +301,10 @@ if (argv['auth-negotiate-delegate-whitelist']) {
296// Some APIs can only be used after this event occurs. 301// Some APIs can only be used after this event occurs.
297app.on('ready', () => { 302app.on('ready', () => {
298 // Register App URL 303 // Register App URL
299 app.setAsDefaultProtocolClient('franz'); 304 app.setAsDefaultProtocolClient('ferdi');
300 305
301 if (isDevMode) { 306 if (isDevMode) {
302 app.setAsDefaultProtocolClient('franz-dev'); 307 app.setAsDefaultProtocolClient('ferdi-dev');
303 } 308 }
304 309
305 if (process.platform === 'win32') { 310 if (process.platform === 'win32') {
@@ -308,13 +313,13 @@ app.on('ready', () => {
308 arguments: `${isDevMode ? `${__dirname} ` : ''}--reset-window`, 313 arguments: `${isDevMode ? `${__dirname} ` : ''}--reset-window`,
309 iconPath: asarPath(path.join(isDevMode ? `${__dirname}../src/` : __dirname, 'assets/images/taskbar/win32/display.ico')), 314 iconPath: asarPath(path.join(isDevMode ? `${__dirname}../src/` : __dirname, 'assets/images/taskbar/win32/display.ico')),
310 iconIndex: 0, 315 iconIndex: 0,
311 title: 'Move Franz to Current Display', 316 title: 'Move Ferdi to Current Display',
312 description: 'Restore the position and size of Franz', 317 description: 'Restore the position and size of Ferdi',
313 }, { 318 }, {
314 program: process.execPath, 319 program: process.execPath,
315 arguments: `${isDevMode ? `${__dirname} ` : ''}--quit`, 320 arguments: `${isDevMode ? `${__dirname} ` : ''}--quit`,
316 iconIndex: 0, 321 iconIndex: 0,
317 title: 'Quit Franz', 322 title: 'Quit Ferdi',
318 }]); 323 }]);
319 } 324 }
320 325