diff --git a/app/buildMenu.js b/app/buildMenu.js index 3faf0ee..2dc3f61 100644 --- a/app/buildMenu.js +++ b/app/buildMenu.js @@ -2,7 +2,7 @@ var electron = require('electron'); var Menu = electron.Menu; var shell = electron.shell; -module.exports = function (app, mainWindow) { +module.exports = function (mainWindow, nativefierVersion, onQuit) { if (Menu.getApplicationMenu()) return; @@ -120,7 +120,7 @@ module.exports = function (app, mainWindow) { role: 'help', submenu: [ { - label: 'Learn More About Nativefier', + label: `Built with Nativefier v${nativefierVersion}`, click: function() { shell.openExternal('https://github.com/jiahaog/nativefier') } }, { @@ -135,13 +135,6 @@ module.exports = function (app, mainWindow) { template.unshift({ label: 'Electron', submenu: [ - { - label: 'About Electron', - role: 'about' - }, - { - type: 'separator' - }, { label: 'Services', role: 'services', @@ -151,7 +144,7 @@ module.exports = function (app, mainWindow) { type: 'separator' }, { - label: 'Hide Electron', + label: 'Hide App', accelerator: 'Command+H', role: 'hide' }, @@ -170,7 +163,7 @@ module.exports = function (app, mainWindow) { { label: 'Quit', accelerator: 'Command+Q', - click: function() { app.quit(); } + click: function() { onQuit(); } }, ] }); diff --git a/app/main.js b/app/main.js index e09efef..88729ba 100644 --- a/app/main.js +++ b/app/main.js @@ -57,7 +57,7 @@ app.on('ready', function () { } ); - buildMenu(app, mainWindow); + buildMenu(mainWindow, appArgs.nativefierVersion, app.quit); mainWindow.loadURL('file://' + __dirname + '/index.html'); diff --git a/src/buildApp.js b/src/buildApp.js index 83fd750..34542e2 100644 --- a/src/buildApp.js +++ b/src/buildApp.js @@ -8,6 +8,8 @@ import ncp from 'ncp'; import async from 'async'; import _ from 'lodash'; +import packageJson from './../package.json'; + const copy = ncp.ncp; /** @@ -65,8 +67,8 @@ function buildApp(options, callback) { * @param {tempDirCallback} callback */ function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, badge, width, height, userAgent, callback) { - copy(srcAppDir, tempDir, error => { - + const loadedPackageJson = packageJson; + copy(srcAppDir, tempDir, function(error) { if (error) { console.error(error); callback(`Error Copying temporary directory: ${error}`); @@ -79,7 +81,8 @@ function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, badge, width, h badge: badge, width: width, height: height, - userAgent: userAgent + userAgent: userAgent, + nativefierVersion: loadedPackageJson.version }; fs.writeFileSync(path.join(tempDir, '/nativefier.json'), JSON.stringify(appArgs));