From 49be67aae678d6770b19a2c15022442991ee9fe9 Mon Sep 17 00:00:00 2001 From: Damillora Date: Mon, 3 Jul 2017 16:59:53 +0700 Subject: [PATCH] add reload menu in macOS dock --- .gitignore | 3 +++ main.js | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..231ff5e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +out +npm-debug.log diff --git a/main.js b/main.js index 16b6f59..428747a 100644 --- a/main.js +++ b/main.js @@ -79,15 +79,18 @@ if (process.platform === 'darwin') { {role: 'front'} ] } - +const dockMenu = Menu.buildFromTemplate([ + {label: 'Reload', click () { win.reload() }} +]) function createWindow () { // Create the browser window. const menu = Menu.buildFromTemplate(template) - Menu.setApplicationMenu(menu) + app.dock.setMenu(dockMenu); + Menu.setApplicationMenu(menu); win = new BrowserWindow({width: 480, height: 600,icon: path.join(__dirname, 'ic_launcher.png')}) - + // and load the index.html of the app. win.loadURL('http://pf.gree.net/58737',{userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F27E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36'}); // Open the DevTools.