add a section to tray to go home

This commit is contained in:
Stephen Birarda 2015-12-28 11:17:35 -08:00
parent 04ce9de6d0
commit 2bbfda5da7

View file

@ -60,6 +60,19 @@ function openFileBrowser(path) {
// if at this point any of the paths are null, we're missing something we wanted to find
// TODO: show an error for the binaries that couldn't be found
function startInterface(url) {
var argArray = [];
// check if we have a url parameter to include
if (url) {
argArray = ["--url", url];
}
// create a new Interface instance - Interface makes sure only one is running at a time
var pInterface = new Process('interface', interfacePath, argArray);
pInterface.start();
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
@ -69,11 +82,22 @@ app.on('ready', function() {
// Create tray icon
tray = new Tray(TRAY_ICON);
tray.setToolTip('High Fidelity');
var contextMenu = Menu.buildFromTemplate([{
var contextMenu = Menu.buildFromTemplate([
{
label: 'Go Home',
click: function() { startInterface('hifi://localhost'); }
},
{
type: 'separator'
},
{
label: 'Quit',
accelerator: 'Command+Q',
click: function() { app.quit(); }
}]);
}
]);
tray.setContextMenu(contextMenu);
var logPath = path.join(app.getAppPath(), 'logs');
@ -101,15 +125,7 @@ app.on('ready', function() {
homeServer.start();
ipcMain.on('start-interface', function(event, arg) {
// check if we have a url parameter to include
var argArray = [];
if (arg && arg.url) {
argArray = ["--url", arg.url];
}
// create a new Interface instance - Interface makes sure only one is running at a time
var pInterface = new Process('interface', interfacePath, argArray);
pInterface.start();
});
ipcMain.on('restart-server', function(event, arg) {