From e92ff29bd378db3d07fa389d9b950834234dbc61 Mon Sep 17 00:00:00 2001 From: jysperm Date: Sun, 24 Sep 2017 14:36:45 +0800 Subject: [PATCH] :wheelchair: Add menu to open dev tools --- main.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 8cee1af..88c53e0 100644 --- a/main.js +++ b/main.js @@ -1,10 +1,33 @@ -const {app, BrowserWindow} = require('electron') +const {app, shell, BrowserWindow, Menu} = require('electron') const path = require('path') const url = require('url') let win +process.env.PATH = `${process.env.PATH}:/usr/local/bin` + +const menu = Menu.buildFromTemplate([ + { + label: app.getName(), + submenu: [{ + label: 'About', + click() { + shell.openExternal('https://github.com/jysperm/elecpass') + } + },{ + label: 'Open DevTools', + click() { + win.webContents.openDevTools() + } + },{ + role: 'quit' + }] + } +]) + function createWindow () { + Menu.setApplicationMenu(menu) + win = new BrowserWindow({width: 650, height: 450}) win.loadURL(url.format({