<commit_before>var app = require('app');  // Module to control application life.
var BrowserWindow = require('browser-window');  // Module to create native browser window.
var Tray = require('tray');  // Module to create native browser window.

// Report crashes to our server.
require('crash-reporter').start();

// 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;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform != 'darwin') {
    app.quit();
  }
});

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 800, height: 900, icon: 'stats100.png'});
  //mainWindow = new BrowserWindow({width: 570, height: 477, icon: 'stats100.png'});
  var appIcon = new Tray('stats100.png');
  appIcon.setTitle('Futures');

  // and load the index.html of the app.
  mainWindow.loadUrl('file://' + __dirname + '/index.html');

  // Open the devtools.
  mainWindow.openDevTools();

  // Emitted when the window is closed.
  mainWindow.on('closed', function() {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });<commit_msg>build up a context menu for the tray<commit_after>var app = require('app');  // Module to control application life.
var BrowserWindow = require('browser-window');  // Module to create native browser window.
var Tray = require('tray');  // Module to create native browser window.
var Menu = require('menu');

// Report crashes to our server.
require('crash-reporter').start();

// 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 appIcon = null;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform != 'darwin') {
    app.quit();
  }
});

var logToBrowser = function() {
if (mainWindow && mainWindow !== null) {
var baseArgs = ['console.log']
mainWindow.webContents.send.apply(mainWindow.webContents, baseArgs.concat([].slice.call(arguments)))
}
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
  // Create the browser window.
  //mainWindow = new BrowserWindow({width: 800, height: 900, icon: 'stats100.png'});
  mainWindow = new BrowserWindow({
    width: 800,
    // height: 650,
    height: 900,
    icon: 'stats100.png',
	center: true,
	'skip-taskbar': true,
	frame: false,
	show: false
  });
  appIcon = new Tray('stats100.png');
  appIcon.setTitle('Futures');
  //var contextMenu = new Menu();
  //contextMenu.append(new MenuItem({ label: 'MenuItem1', click: function() { console.log('item 1 clicked'); } }));

  var contextMenu = Menu.buildFromTemplate([
    { label: 'Show/Hide Venmo',
      //type: 'radio',
      click: function(){
		if (mainWindow.isVisible()) {
		  mainWindow.hide()
		} else {
		  //mainWindow.setPosition(parseInt(bounds.x + (bounds.width / 2) - 400), bounds.y + bounds.height)
		  mainWindow.show()
		}
      }
    },
  ]);
  //appIcon.setToolTip('This is my application.');
  appIcon.setContextMenu(contextMenu);

  appIcon.on('clicked', function(e, bounds) {
    logToBrowser('app icon clicked', e)
    logToBrowser('app icon clicked', bounds)
    console.log(bounds)
    if (mainWindow.isVisible()) {
      mainWindow.hide()
    } else {
      mainWindow.setPosition(parseInt(bounds.x + (bounds.width / 2) - 400), bounds.y + bounds.height)
      mainWindow.show()
    }
  })





  // and load the index.html of the app.
  mainWindow.loadUrl('file://' + __dirname + '/index.html');

  // Open the devtools.
  mainWindow.openDevTools();

  // Emitted when the window is closed.
  mainWindow.on('closed', function() {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });
{'fraction_non_alphanumeric': 0.13253796095444687, 'fraction_numerical': 0.01193058568329718, 'mean_word_length': 3.450772200772201, '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': '6548083', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1331, 'n_words': 477}