Skip to content

Commit

Permalink
Clutter removed
Browse files Browse the repository at this point in the history
  • Loading branch information
zonayedpca committed Aug 20, 2019
1 parent 6d78858 commit f399ef9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 72 deletions.
9 changes: 3 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ const path = require('path');
const MainWindow = require('./src/module/MainWindow');
const ApplicationTray = require('./src/module/ApplicationTray');

const { clipboard, code, settings } = require('./src/service');
const { clipboard, code } = require('./src/service');

function isDev() {
return process.mainModule.filename.indexOf('app.asar') === -1;
}
const { isDev } = require('./src/utils');

const WINDOW_URL = isDev() ? `http://localhost:3000` : `file://${__dirname}/client/build/index.html`;
const iconName = process.platform === 'darwin' ? 'iconTemplate.png':'windows-icon.png';
Expand All @@ -24,10 +22,9 @@ app.on('ready', () => {
frame: isDev() ? true : false,
resizable: isDev() ? true : false,
show: isDev() ? true : false,
webPreferences: { backgroundThrottling: false, nodeIntegration: true }
webPreferences: { devTools: isDev() ? true : false, backgroundThrottling: false, nodeIntegration: true }
}, WINDOW_URL);
tray = new ApplicationTray(iconPath, mainWindow);
clipboard(mainWindow);
code(mainWindow);
settings(mainWindow);
})
6 changes: 4 additions & 2 deletions src/module/MainWindow.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
const { BrowserWindow, shell } = require('electron');

const { isDev } = require('../utils');

class MainWindow extends BrowserWindow {
constructor(config, windowUrl) {
super(config);
// this.setSkipTaskbar(true); // enable after development
!isDev() && this.setSkipTaskbar(true);
this.loadURL(windowUrl);
this.on('blur', this.onBlur.bind(this));
this.webContents.on('will-navigate', this.onWillNavigate.bind(this));
}

onBlur() {
// this.hide(); // enable this after development
!isDev() && this.hide();
}

onWillNavigate(event, url) {
Expand Down
4 changes: 1 addition & 3 deletions src/service/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const clipboard = require('./clipboard');
const code = require('./code');
const settings = require('./settings');

module.exports = {
clipboard,
code,
settings
code
}
61 changes: 0 additions & 61 deletions src/service/settings.js

This file was deleted.

5 changes: 5 additions & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const isDev = require('./isDev');

module.exports = {
isDev
}
1 change: 1 addition & 0 deletions src/utils/isDev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = () => process.mainModule.filename.indexOf('app.asar') === -1;

0 comments on commit f399ef9

Please sign in to comment.