<commit_before>const {app, Menu, Tray, ipcMain: ipc, BrowserWindow } = require('electron');
const path = require('path');
const exec = require('child_process').exec;
const commands = require('./commands/' + process.platform);


const mb = require('menubar')({
    dir: __dirname,
    transparent: true,
    title: "Zomnifer",
    icon: path.join(__dirname, '../Icon.png')
});


/**
 * The app is ready, I just set some things here so that it feels more Zomniferified
 */
mb.on('ready', function ready () {
  console.log([
    '\n======================\n',
    ' Welcome to Zomnifer!',
    '\n======================\n'
  ].join(''));

  // window size & decoration
  mb.setOption('width', 500);
  mb.setOption('height', 330);

  mb.setOption('minWidth', 500);
  mb.setOption('minHeight', 330);
  
  mb.setOption('tooltip', 'Zomnifer');
  mb.setOption('showDowkIcon', false);
  mb.setOption('icon', path.join(__dirname, '../Icon.png'));

  // yes you can quit the app too ...
  const trayMenu = Menu.buildFromTemplate([{label: 'Quit Zomnifer', role: 'quit'}]);
  mb.tray.setContextMenu(trayMenu);

})



/**
 * 
 * This is short but is what all the app has been done for! :)
 * 
 */

let messageWindow = null;

ipc.on('SHUTDOWN', () => exec(commands.shutdown, log));
ipc.on('SLEEP'   , () => exec(commands.sleep, log));
ipc.on('MESSAGE' , (e, mess) => {
  messageWindow = new BrowserWindow({
    width: 400, 
    height: 300,
  })

  console.log('[MESSAGE]', mess);
  messageWindow.setMenu(null);
  messageWindow.loadURL(`file://${ __dirname }/message.html?message=${ encodeURIComponent(mess) }`)
  messageWindow.on('closed', () => {
    messageWindow = null
  })
});

function log(err, stdout, stderr) {
  if(err) {
    console.log('[ERROR]', err);
    return;
  }
  console.log('[STDOUT]', stdout);
  console.log('[STDERR]', stderr);
}
<commit_msg>Add context menu for linux (and darwin ?)<commit_after>const {app, Menu, Tray, ipcMain: ipc, BrowserWindow } = require('electron');
const path = require('path');
const exec = require('child_process').exec;
const commands = require('./commands/' + process.platform);


const mb = require('menubar')({
    dir: __dirname,
    transparent: true,
    title: "Zomnifer",
    icon: path.join(__dirname, '../Icon.png')
});


/**
 * The app is ready, I just set some things here so that it feels more Zomniferified
 */
mb.on('ready', function ready () {
  console.log([
    '\n======================\n',
    ' Welcome to Zomnifer!',
    '\n======================\n'
  ].join(''));

  // window size & decoration
  mb.setOption('width', 500);
  mb.setOption('height', 330);

  mb.setOption('minWidth', 500);
  mb.setOption('minHeight', 330);
  
  mb.setOption('tooltip', 'Zomnifer');
  mb.setOption('showDowkIcon', false);
  mb.setOption('icon', path.join(__dirname, '../Icon.png'));

  // yes you can quit the app too ...
  const trayMenu = Menu.buildFromTemplate([
    {
      label: 'Show Zomnifer',
      click: () => mb.showWindow()
    },
    {
      type: 'separator'
    },
    {
      label: 'Quit Zomnifer',
      role: 'quit'
    },
  ]);
  mb.tray.setContextMenu(trayMenu);

})



/**
 * 
 * This is short but is what all the app has been done for! :)
 * 
 */

let messageWindow = null;

ipc.on('SHUTDOWN', () => exec(commands.shutdown, log));
ipc.on('SLEEP'   , () => exec(commands.sleep, log));
ipc.on('MESSAGE' , (e, mess) => {
  messageWindow = new BrowserWindow({
    width: 400, 
    height: 300,
  })

  console.log('[MESSAGE]', mess);
  messageWindow.setMenu(null);
  messageWindow.loadURL(`file://${ __dirname }/message.html?message=${ encodeURIComponent(mess) }`)
  messageWindow.on('closed', () => {
    messageWindow = null
  })
});

function log(err, stdout, stderr) {
  if(err) {
    console.log('[ERROR]', err);
    return;
  }
  console.log('[STDOUT]', stdout);
  console.log('[STDERR]', stderr);
}

{'fraction_non_alphanumeric': 0.21029487842731506, 'fraction_numerical': 0.009311950336264873, 'mean_word_length': 3.6478365384615383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '1943171', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1311, 'n_words': 301}