Newer
Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
import electron from 'electron';
import { killParity } from '@parity/electron';
Luke Schoen
committed
import Pino from './app/utils/pino';
Luke Schoen
committed
import FetherApp from './app';
import fetherAppOptions from './app/options';
const { app } = electron;
Luke Schoen
committed
const pino = Pino();
let withTaskbar = process.env.TASKBAR !== 'false';
pino.info('Platform detected: ', process.platform);
// Disable gpu acceleration on linux
// https://github.com/parity-js/fether/issues/85
if (!['darwin', 'win32'].includes(process.platform)) {
const options = fetherAppOptions(withTaskbar, {});
Luke Schoen
committed
return new FetherApp(app, options);
Luke Schoen
committed
});
// Event triggered by clicking the Electron icon in the menu Dock
// Reference: https://electronjs.org/docs/api/app#event-activate-macos
app.on('activate', (event, hasVisibleWindows) => {
if (withTaskbar) {
pino.info(
'Detected Fether taskbar mode. Launching from application dock is not permitted.'
);
return;
}
if (hasVisibleWindows) {
pino.info('Existing Fether window detected.');
return;
}
Luke Schoen
committed
return new FetherApp(app, options);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
// Make sure Parity Ethereum stops when UI stops
app.on('before-quit', killParity);
Luke Schoen
committed
app.on('will-quit', killParity);
Luke Schoen
committed
app.on('quit', () => {
pino.info('Leaving Fether');
killParity();