aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/index.js b/src/index.js
index 3056a8bec..87aa6357b 100644
--- a/src/index.js
+++ b/src/index.js
@@ -9,9 +9,13 @@ import fs from 'fs-extra';
9import path from 'path'; 9import 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 12if (process.platform === 'win32') {
13 app.setPath('appData', process.env.LOCALAPPDATA);
14 app.setPath('userData', path.join(process.env.LOCALAPPDATA, app.getName()));
15}
16
13if (isDevMode) { 17if (isDevMode) {
14 app.setPath('userData', path.join(app.getPath('appData'), 'FranzDev')); 18 app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}Dev`));
15} 19}
16 20
17/* eslint-disable import/first */ 21/* eslint-disable import/first */
@@ -37,7 +41,7 @@ import { asarPath } from './helpers/asar-helpers';
37import { isValidExternalURL } from './helpers/url-helpers'; 41import { isValidExternalURL } from './helpers/url-helpers';
38/* eslint-enable import/first */ 42/* eslint-enable import/first */
39 43
40const debug = require('debug')('Franz:App'); 44const debug = require('debug')('Ferdi:App');
41 45
42// Keep a global reference of the window object, if you don't, the window will 46// 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. 47// be closed automatically when the JavaScript object is garbage collected.
@@ -103,7 +107,7 @@ if (!gotTheLock) {
103 } else if (argv.includes('--quit')) { 107 } else if (argv.includes('--quit')) {
104 // Needs to be delayed to not interfere with mainWindow.restore(); 108 // Needs to be delayed to not interfere with mainWindow.restore();
105 setTimeout(() => { 109 setTimeout(() => {
106 debug('Quitting Franz via Task'); 110 debug('Quitting Ferdi via Task');
107 app.quit(); 111 app.quit();
108 }, 1); 112 }, 1);
109 } 113 }
@@ -142,6 +146,13 @@ const createWindow = () => {
142 } 146 }
143 147
144 // Create the browser window. 148 // Create the browser window.
149 let backgroundColor = '#7367F0';
150 if (settings.get('accentColor') !== '#7367f0') {
151 backgroundColor = settings.get('accentColor');
152 } else if (settings.get('darkMode')) {
153 backgroundColor = '#1E1E1E';
154 }
155
145 mainWindow = new BrowserWindow({ 156 mainWindow = new BrowserWindow({
146 x: posX, 157 x: posX,
147 y: posY, 158 y: posY,
@@ -151,7 +162,7 @@ const createWindow = () => {
151 minHeight: 500, 162 minHeight: 500,
152 titleBarStyle: isMac ? 'hidden' : '', 163 titleBarStyle: isMac ? 'hidden' : '',
153 frame: isLinux, 164 frame: isLinux,
154 backgroundColor: !settings.get('darkMode') ? '#3498db' : '#1E1E1E', 165 backgroundColor,
155 webPreferences: { 166 webPreferences: {
156 nodeIntegration: true, 167 nodeIntegration: true,
157 webviewTag: true, 168 webviewTag: true,
@@ -161,7 +172,7 @@ const createWindow = () => {
161 mainWindow.webContents.on('did-finish-load', () => { 172 mainWindow.webContents.on('did-finish-load', () => {
162 const fns = onDidLoadFns; 173 const fns = onDidLoadFns;
163 onDidLoadFns = null; 174 onDidLoadFns = null;
164 for (const fn of fns) { 175 for (const fn of fns) { // eslint-disable-line no-unused-vars
165 fn(mainWindow); 176 fn(mainWindow);
166 } 177 }
167 }); 178 });
@@ -284,7 +295,7 @@ const createWindow = () => {
284// https://electronjs.org/docs/api/chrome-command-line-switches 295// https://electronjs.org/docs/api/chrome-command-line-switches
285// used for Kerberos support 296// used for Kerberos support
286// Usage e.g. MACOS 297// Usage e.g. MACOS
287// $ Franz.app/Contents/MacOS/Franz --auth-server-whitelist *.mydomain.com --auth-negotiate-delegate-whitelist *.mydomain.com 298// $ Franz.app/Contents/MacOS/Ferdi --auth-server-whitelist *.mydomain.com --auth-negotiate-delegate-whitelist *.mydomain.com
288const argv = require('minimist')(process.argv.slice(1)); 299const argv = require('minimist')(process.argv.slice(1));
289 300
290if (argv['auth-server-whitelist']) { 301if (argv['auth-server-whitelist']) {
@@ -299,10 +310,10 @@ if (argv['auth-negotiate-delegate-whitelist']) {
299// Some APIs can only be used after this event occurs. 310// Some APIs can only be used after this event occurs.
300app.on('ready', () => { 311app.on('ready', () => {
301 // Register App URL 312 // Register App URL
302 app.setAsDefaultProtocolClient('franz'); 313 app.setAsDefaultProtocolClient('ferdi');
303 314
304 if (isDevMode) { 315 if (isDevMode) {
305 app.setAsDefaultProtocolClient('franz-dev'); 316 app.setAsDefaultProtocolClient('ferdi-dev');
306 } 317 }
307 318
308 if (process.platform === 'win32') { 319 if (process.platform === 'win32') {
@@ -311,13 +322,13 @@ app.on('ready', () => {
311 arguments: `${isDevMode ? `${__dirname} ` : ''}--reset-window`, 322 arguments: `${isDevMode ? `${__dirname} ` : ''}--reset-window`,
312 iconPath: asarPath(path.join(isDevMode ? `${__dirname}../src/` : __dirname, 'assets/images/taskbar/win32/display.ico')), 323 iconPath: asarPath(path.join(isDevMode ? `${__dirname}../src/` : __dirname, 'assets/images/taskbar/win32/display.ico')),
313 iconIndex: 0, 324 iconIndex: 0,
314 title: 'Move Franz to Current Display', 325 title: 'Move Ferdi to Current Display',
315 description: 'Restore the position and size of Franz', 326 description: 'Restore the position and size of Ferdi',
316 }, { 327 }, {
317 program: process.execPath, 328 program: process.execPath,
318 arguments: `${isDevMode ? `${__dirname} ` : ''}--quit`, 329 arguments: `${isDevMode ? `${__dirname} ` : ''}--quit`,
319 iconIndex: 0, 330 iconIndex: 0,
320 title: 'Quit Franz', 331 title: 'Quit Ferdi',
321 }]); 332 }]);
322 } 333 }
323 334