<commit_before>console.time('init');

const {app, Tray, BrowserWindow, ipcMain} = require('electron');
const path = require('path');

const appIconDefault = path.join(__dirname, 'static', 'appIcon.png');
const isDev = process.env.NODE_ENV !== "build";
const appUrl = isDev ? 'http://localhost:8080' : `file://${__dirname}/dist/index.html`;

let tray;
let win;

const calculateWinPos = (bounds) => {
  return {
    x: (bounds.x + (bounds.width / 2)) - 150,
    y: bounds.y
  };
};

app.on('ready', () => {
  app.dock.hide();

  tray = new Tray(appIconDefault);
  tray.setToolTip('TogglApp');

  win = new BrowserWindow({
    title: 'TogglApp',
    width: 300,
    height: 240,
    frame: false,
    resizable: false,
    movable: false,
    show: isDev ? true : false,
    alwaysOnTop: true
  });

  win.loadURL(appUrl);

  tray.on('click', (e, bounds) => {
    let pos = calculateWinPos(bounds);

    win.setPosition(pos.x, pos.y);
    win.show();
  });

  win.on('blur', () => {
    if (!isDev) {
      win.hide();
    }
  });

  ipcMain.on('timer-on', () => {
    win.setSize(300, 120, true);
  });

  ipcMain.on('timer-off', () => {
    win.setSize(300, 240, true);
  });

  ipcMain.once('close-app', () => {
    app.quit();
  });

  console.timeEnd('init');
});<commit_msg>change app icon when timer is active<commit_after>console.time('init');

const {app, Tray, BrowserWindow, ipcMain} = require('electron');
const path = require('path');

const appIconDefault = path.join(__dirname, 'static', 'appIcon.png');
const appIconActive = path.join(__dirname, 'static', 'appIconActive.png');
const isDev = process.env.NODE_ENV !== "build";
const appUrl = isDev ? 'http://localhost:8080' : `file://${__dirname}/dist/index.html`;

let tray;
let win;

const calculateWinPos = (bounds) => {
  return {
    x: (bounds.x + (bounds.width / 2)) - 150,
    y: bounds.y
  };
};

app.on('ready', () => {
  app.dock.hide();

  tray = new Tray(appIconDefault);
  tray.setToolTip('TogglApp');

  win = new BrowserWindow({
    title: 'TogglApp',
    width: 300,
    height: 240,
    frame: false,
    resizable: false,
    movable: false,
    show: isDev ? true : false,
    alwaysOnTop: true
  });

  win.loadURL(appUrl);

  tray.on('click', (e, bounds) => {
    let pos = calculateWinPos(bounds);

    win.setPosition(pos.x, pos.y);
    win.show();
  });

  win.on('blur', () => {
    if (!isDev) {
      win.hide();
    }
  });

  ipcMain.on('timer-on', () => {
    tray.setImage(appIconActive);
    win.setSize(300, 120, true);
  });

  ipcMain.on('timer-off', () => {
    tray.setImage(appIconDefault);
    win.setSize(300, 240, true);
  });

  ipcMain.once('close-app', () => {
    app.quit();
  });

  console.timeEnd('init');
});
{'fraction_non_alphanumeric': 0.20286659316427783, 'fraction_numerical': 0.019110621095185593, 'mean_word_length': 3.2332814930015554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '3411791', 'n_tokens_mistral': 1069, 'n_tokens_neox': 998, 'n_words': 195}