<commit_before>var root = 'file://' + __dirname + '/';
var ELECTRON = require('electron');

var app = ELECTRON.app;  // Module to control application life.
var BrowserWindow = ELECTRON.BrowserWindow;  // Module to create native browser window.
var Tray = ELECTRON.Tray;
var Menu = ELECTRON.Menu;

app.commandLine.appendSwitch('v', -1);
app.commandLine.appendSwitch('vmodule', 'console=0');

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;
var appTray = null, mnuTray = null;

var quitApp = app.makeSingleInstance(forwardCommandLine);
if (quitApp) {
	app.quit();
	return;
}

global.server = require('./server.js');

// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on('ready', runApplication);
app.on('will-quit', function() {
	global.server.close();
});
// Quit when all windows are closed.
app.on('window-all-closed', function() { });

function forwardCommandLine(command, working) {
	if (!!appTray) {
		console.log('Forwarding: ' + command);
	}
	return !!appTray
}

function runApplication() {
	if (!!!appTray) {
		appTray = new Tray('./icons/tray.png');
		mnuTray = Menu.buildFromTemplate([
			{label: 'Item1'},
			{label: 'Item2'},
			{label: 'Item3'},
			{label: 'Quit Gossamer', click: closeApplication}
		]);
		appTray.setToolTip('Gossamer');
		appTray.setContextMenu(mnuTray);
		appTray.on('click', showMainWindow);
		global.server.start();
	}
}

function showMainWindow() {
	if (!!!mainWindow) {

	// Create the browser window.
		mainWindow = new BrowserWindow({
			width: 350,
			height: ELECTRON.screen.getPrimaryDisplay().workAreaSize.height,
			x: ELECTRON.screen.getPrimaryDisplay().workAreaSize.width - 350,
			y: 0,
			transparent: true,
			frame: false
		});
		mainWindow.on('close', function(event) {
			event.preventDefault();
			mainWindow.hide();
		})
	// and load the index.html of the app.
		mainWindow.loadURL(root + './control-panel/index.html');

	// Open the devtools.
		//mainWindow.openDevTools({detach: true});
	}
	else mainWindow.show();
}

function closeApplication() {
	if (!!mainWindow) {
		mainWindow.destroy();
	}
	app.quit();
}
<commit_msg>Added icon<commit_after>var root = 'file://' + __dirname + '/';
var ELECTRON = require('electron');

var app = ELECTRON.app;  // Module to control application life.
var BrowserWindow = ELECTRON.BrowserWindow;  // Module to create native browser window.
var Tray = ELECTRON.Tray;
var Menu = ELECTRON.Menu;

app.commandLine.appendSwitch('v', -1);
app.commandLine.appendSwitch('vmodule', 'console=0');

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;
var appTray = null, mnuTray = null;

var quitApp = app.makeSingleInstance(forwardCommandLine);
if (quitApp) {
	app.quit();
	return;
}

global.server = require('./server.js');

// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on('ready', runApplication);
app.on('will-quit', function() {
	global.server.close();
});
// Quit when all windows are closed.
app.on('window-all-closed', function() { });

function forwardCommandLine(command, working) {
	if (!!appTray) {
		console.log('Forwarding: ' + command);
	}
	return !!appTray
}

function runApplication() {
	if (!!!appTray) {
		appTray = new Tray('./icons/tray.png');
		mnuTray = Menu.buildFromTemplate([
			{label: 'Item1'},
			{label: 'Item2'},
			{label: 'Item3'},
			{label: 'Quit Gossamer', click: closeApplication}
		]);
		appTray.setToolTip('Gossamer');
		appTray.setContextMenu(mnuTray);
		appTray.on('click', showMainWindow);
		global.server.start();
	}
}

function showMainWindow() {
	if (!!!mainWindow) {

	// Create the browser window.
		mainWindow = new BrowserWindow({
			width: 350,
			height: ELECTRON.screen.getPrimaryDisplay().workAreaSize.height,
			x: ELECTRON.screen.getPrimaryDisplay().workAreaSize.width - 350,
			y: 0,
			icon: './icons/tray.png',
			transparent: true,
			frame: false
		});
		mainWindow.on('close', function(event) {
			event.preventDefault();
			mainWindow.hide();
		})
	// and load the index.html of the app.
		mainWindow.loadURL(root + './control-panel/index.html');

	// Open the devtools.
		//mainWindow.openDevTools({detach: true});
	}
	else mainWindow.show();
}

function closeApplication() {
	if (!!mainWindow) {
		mainWindow.destroy();
	}
	app.quit();
}

{'fraction_non_alphanumeric': 0.15499124343257442, 'fraction_numerical': 0.005253940455341506, 'mean_word_length': 4.2217142857142855, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3573868', 'n_tokens_mistral': 1628, 'n_tokens_neox': 1495, 'n_words': 379}