From bf72600daae03d15a3b4d0357d3ed6965f12ad33 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 4 Nov 2015 13:52:57 +0000 Subject: [PATCH] Added tray icon --- src/main.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 6168add..3b5ce7b 100644 --- a/src/main.js +++ b/src/main.js @@ -13,6 +13,7 @@ var menu = new Menu(); Menu.setApplicationMenu(menu); var mainWindow = null; var audioController = null; +var icon = null; // Make sure the application closes app.on('window-all-closed', function () { @@ -20,15 +21,19 @@ app.on('window-all-closed', function () { }); app.on('ready', function () { + icon = new Tray(null); + icon.setToolTip('Keyboard Mechanizer | Click to show'); + icon.on('click', function () { + mainWindow.show(); + }); + mainWindow = new BrowserWindow({ width: 800, height: 600, frame: false }); mainWindow.loadUrl('file://' + __dirname + '/index.html'); - mainWindow.toggleDevTools(); - mainWindow.on('closed', function() { mainWindow = undefined; audioController.close();