diff --git a/main.js b/main.js index f9575bb456..21899e81c3 100644 --- a/main.js +++ b/main.js @@ -8,6 +8,7 @@ var BrowserWindow = electron.BrowserWindow var Menu = electron.Menu var ipcMain = electron.ipcMain var dialog = electron.dialog +var MenuItem = electron.MenuItem var darwinTemplate = require('./menus/darwin-menu.js') var otherTemplate = require('./menus/other-menu.js') @@ -106,6 +107,15 @@ app.on('ready', function appReady () { mainWindow.setMenu(menu) } + var ctxMenu = new Menu() + ctxMenu.append(new MenuItem({role: 'startspeaking'})) + ctxMenu.append(new MenuItem({role: 'stopspeaking'})) + ctxMenu.append(new MenuItem({role: 'copy'})) + ctxMenu.append(new MenuItem({role: 'selectall'})) + mainWindow.webContents.on('context-menu', function(e, params){ + ctxMenu.popup(mainWindow, params.x, params.y) + }) + mainWindow.on('closed', function winClosed () { mainWindow = null })