<commit_before>'use strict';

const electron = require('electron');
const app = electron.app;  // Module to control application life.
const BrowserWindow = electron.BrowserWindow;  // Module to create native browser window.
const localShortcut = require('electron-localshortcut');

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var mainWindow = null;

function fullScreenHandler () {
  if (!mainWindow.isFocused()) {
    return;
  }
  if (mainWindow.isFullScreen()) {
    mainWindow.setFullScreen(false);
    return;
  }
  mainWindow.setFullScreen(true);
}

function closedHandler () {
  // 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;
}

function readyHandler () {
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 800, height: 600});

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

  // Emitted when the window is closed.
  mainWindow.on('closed', closedHandler);

  // Register global shortcuts.
  localShortcut.register(mainWindow, 'cmd+ctrl+f', fullScreenHandler);
}

function allClosedHandler () {
  // 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();
  }
}

function willQuitHandler () {
  // Un-register all shortcuts.
  localShortcut.unregisterAll(mainWindow);
}
<commit_msg>Main application menu with useful shortcuts<commit_after>'use strict';

const electron = require('electron');
const app = electron.app;  // Module to control application life.
const BrowserWindow = electron.BrowserWindow;  // Module to create native browser window.
const menu = require('menu');
const localShortcut = require('electron-localshortcut');

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var mainWindow = null;

/**
 * On full screen, check if main window is focused, and if not return.
 * If main window is focused and on full screen already then set to false
 * otherwise to full screen true.
 */
function fullScreenHandler () {
  if (!mainWindow.isFocused()) {
    return;
  }
  if (mainWindow.isFullScreen()) {
    mainWindow.setFullScreen(false);
    return;
  }
  mainWindow.setFullScreen(true);
}

/**
 * On close 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.
 */
function closedHandler () {
  mainWindow = null;
}

function readyHandler () {
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 800, height: 600});

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

  // Emitted when the window is closed.
  mainWindow.on('closed', closedHandler);

  // Register global shortcuts.
  localShortcut.register(mainWindow, 'Command+Ctrl+F', fullScreenHandler);

  // Create the Application's main menu.
  const template = getMenuTemplate();

  menu.setApplicationMenu(menu.buildFromTemplate(template));
}

/**
 * On OS X it is common for applications and their menu bar
 * to stay active until the user quits explicitly with Cmd + Q.
 */
function allClosedHandler () {
  if (process.platform != 'darwin') {
    app.quit();
  }
}

/**
 * Un-register all shortcuts.
 */
function willQuitHandler () {
  localShortcut.unregisterAll(mainWindow);
}

/**
 * Get the template to use for main application menu.
 * @returns {Object} The template.
 */
function getMenuTemplate () {
  return [{
    label: 'Application',
    submenu: [{
      label: 'About Zazu', selector: 'orderFrontStandardAboutPanel:'
    }, {
      type: 'separator'
    }, {
      label: 'Quit', accelerator: 'Command+Q', click: function () {
        app.quit();
      }
    }]
  }, {
    label: 'Edit',
    submenu: [{
      label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:'
    }, {
      label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:'
    }, {
      type: 'separator'
    }, {
      label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:'
    }, {
      label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:'
    }, {
      label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:'
    }, {
      label: 'Select All', accelerator: 'CmdOrCtrl+A', selector: 'selectAll:'
    }]
  }];
}

{'fraction_non_alphanumeric': 0.12236196972926881, 'fraction_numerical': 0.002558089959496909, 'mean_word_length': 3.6135693215339235, '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': '5019060', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1327, 'n_words': 458}