1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
Keyboard-Mechanizer/src/main.js

63 lines
1.4 KiB
JavaScript
Raw Normal View History

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');
require('crash-reporter').start(); // Start crash reporter
// Creating menu
var menu = new Menu();
Menu.setApplicationMenu(menu);
var mainWindow = null;
var audioController = null;
2015-11-04 13:52:57 +00:00
var icon = null;
// 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();
});
mainWindow = new BrowserWindow({
width: 800,
2015-11-02 14:13:47 +00:00
height: 600,
frame: false
});
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.toggleDevTools();
mainWindow.on('closed', function() {
mainWindow = undefined;
audioController.close();
});
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();
});