2015-11-01 19:21:54 +00:00
|
|
|
var app = require('app');
|
|
|
|
var BrowserWindow = require('browser-window');
|
|
|
|
var Menu = require('menu');
|
|
|
|
var globalShortcut = require('global-shortcut')
|
|
|
|
var fs = require('fs');
|
|
|
|
var Tray = require('tray');
|
2015-11-03 08:46:19 +00:00
|
|
|
var ipc = require('ipc');
|
2015-11-01 19:21:54 +00:00
|
|
|
|
|
|
|
require('crash-reporter').start(); // Start crash reporter
|
|
|
|
|
|
|
|
// Creating menu
|
|
|
|
var menu = new Menu();
|
|
|
|
Menu.setApplicationMenu(menu);
|
|
|
|
var mainWindow = null;
|
2015-11-04 13:29:30 +00:00
|
|
|
var audioController = null;
|
2015-11-04 13:52:57 +00:00
|
|
|
var icon = null;
|
2015-11-01 19:21:54 +00:00
|
|
|
|
|
|
|
// Make sure the application closes
|
|
|
|
app.on('window-all-closed', function () {
|
|
|
|
app.quit();
|
|
|
|
});
|
|
|
|
|
|
|
|
app.on('ready', function () {
|
2015-11-04 14:08:14 +00:00
|
|
|
icon = new Tray(__dirname + '/img/icon.png');
|
2015-11-04 13:52:57 +00:00
|
|
|
icon.setToolTip('Keyboard Mechanizer | Click to show');
|
2015-11-04 14:08:14 +00:00
|
|
|
icon.on('clicked', function () {
|
|
|
|
console.log("Icon Clicked");
|
2015-11-04 13:52:57 +00:00
|
|
|
mainWindow.show();
|
|
|
|
});
|
|
|
|
|
2015-11-01 19:21:54 +00:00
|
|
|
mainWindow = new BrowserWindow({
|
|
|
|
width: 800,
|
2015-11-02 14:13:47 +00:00
|
|
|
height: 600,
|
|
|
|
frame: false
|
2015-11-01 19:21:54 +00:00
|
|
|
});
|
|
|
|
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
|
|
|
mainWindow.toggleDevTools();
|
|
|
|
mainWindow.on('closed', function() {
|
2015-11-04 13:29:30 +00:00
|
|
|
mainWindow = undefined;
|
|
|
|
audioController.close();
|
2015-11-01 19:21:54 +00:00
|
|
|
});
|
2015-11-04 13:29:30 +00:00
|
|
|
|
|
|
|
audioController = new BrowserWindow({
|
|
|
|
width: 1,
|
|
|
|
height: 1,
|
|
|
|
hide: true,
|
|
|
|
frame: false
|
|
|
|
});
|
|
|
|
audioController.loadUrl('file://' + __dirname + '/audio.html');
|
2015-11-04 14:10:11 +00:00
|
|
|
audioController.on('closed', function () { audioController = undefined; });
|
2015-11-03 08:46:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
ipc.on('hide', function () {
|
|
|
|
mainWindow.hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
ipc.on('show', function () {
|
|
|
|
mainWindow.show();
|
2015-11-04 08:58:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
ipc.on('close', function () {
|
|
|
|
mainWindow.close();
|
2015-11-01 19:21:54 +00:00
|
|
|
});
|