add application menu

This commit is contained in:
Paul Frazee
2015-06-24 13:14:52 -05:00
parent af5b5c5706
commit db3018c698
2 changed files with 20 additions and 9 deletions

View File

@@ -12,17 +12,28 @@ var tray
app.on('ready', function ready () {
// start sbot
require('scuttlebot').init(config, function (err, sbot) {
// open the web app
shell.openExternal('http://localhost:8008')
// setup menu
Menu.setApplicationMenu(Menu.buildFromTemplate([{
label: 'Window',
submenu: [
{ label: 'Open Web App', click: onopen },
{ label: 'Quit', click: onquit }
]
}]))
// setup tray icon
tray = new Tray(__dirname+'/icon.png')
var contextMenu = Menu.buildFromTemplate([
{ label: 'Open App', click: onopen },
tray.setContextMenu(Menu.buildFromTemplate([
{ label: 'Open Web App', click: onopen },
{ label: 'Quit', click: onquit }
])
tray.setContextMenu(contextMenu)
]))
tray.setToolTip('Secure Scuttlebutt: Running on port 8008')
tray.on('double-clicked', onopen)
// menu handlers
function onopen () {
shell.openExternal('http://localhost:8008')
}