From 329d82a18c050930c14a3634d694e4bcb78c41da Mon Sep 17 00:00:00 2001 From: Felipe Arenales Date: Fri, 22 Jan 2016 12:42:56 -0200 Subject: [PATCH] Hiding menu bar by default --- README.md | 8 ++++++++ app/nativefier.json | 1 + app/src/main.js | 1 + src/buildApp.js | 6 ++++-- src/cli.js | 3 ++- src/options.js | 2 ++ 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b185e61..0b2a3f3 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,14 @@ Width of the packaged application, defaults to `1280px`. Height of the packaged application, defaults to `800px`. +#### [show-menu-bar] + +``` +-m, --show-menu-bar +``` + +Specifies if the menu bar should be shown. + #### [user-agent] ``` diff --git a/app/nativefier.json b/app/nativefier.json index 99a5586..30591e3 100644 --- a/app/nativefier.json +++ b/app/nativefier.json @@ -4,5 +4,6 @@ "badge": false, "width": 1280, "height": 800, + "showMenuBar": false, "showDevTools": false } diff --git a/app/src/main.js b/app/src/main.js index 915f8ac..5a5872a 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -54,6 +54,7 @@ app.on('ready', function () { { width: appArgs.width || 1280, height: appArgs.height || 800, + 'auto-hide-menu-bar': ! appArgs.showMenuBar, 'web-preferences': { javascript: true, plugins: true, diff --git a/src/buildApp.js b/src/buildApp.js index acd576a..ee9b596 100644 --- a/src/buildApp.js +++ b/src/buildApp.js @@ -31,7 +31,7 @@ function buildApp(options, callback) { async.waterfall([ callback => { - copyPlaceholderApp(options.dir, tmpPath, options.name, options.targetUrl, options.badge, options.counter, options.width, options.height, options.userAgent, callback); + copyPlaceholderApp(options.dir, tmpPath, options.name, options.targetUrl, options.badge, options.counter, options.width, options.height, options.showMenuBar, options.userAgent, callback); }, (tempDir, callback) => { @@ -64,10 +64,11 @@ function buildApp(options, callback) { * @param {boolean} counter * @param {number} width * @param {number} height + * @param {boolean} showMenuBar * @param {string} userAgent * @param {tempDirCallback} callback */ -function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, badge, counter, width, height, userAgent, callback) { +function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, badge, counter, width, height, showMenuBar, userAgent, callback) { const loadedPackageJson = packageJson; copy(srcAppDir, tempDir, function(error) { if (error) { @@ -83,6 +84,7 @@ function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, badge, counter, counter: counter, width: width, height: height, + showMenuBar: showMenuBar, userAgent: userAgent, nativefierVersion: loadedPackageJson.version }; diff --git a/src/cli.js b/src/cli.js index 8dbf778..af4942d 100755 --- a/src/cli.js +++ b/src/cli.js @@ -27,6 +27,7 @@ function main(program) { program.counter, program.width, program.height, + program.showMenuBar, program.userAgent, program.honest, callback); @@ -40,7 +41,6 @@ function main(program) { console.error(error); return; } - console.log(`App built to ${appPath}`); }); } @@ -64,6 +64,7 @@ if (require.main === module) { .option('-i, --icon ', 'the icon file to use as the icon for the app (should be a .icns file on OSX)') .option('-w, --width ', 'set window width, defaults to 1280px', parseInt) .option('-h, --height ', 'set window height, defaults to 800px', parseInt) + .option('-m, --show-menu-bar', 'set menu bar visible, defaults to false') .option('-u, --user-agent ', 'set the user agent string for the app') .option('--honest', 'prevent the nativefied app from changing the user agent string to masquerade as a regular chrome browser') .parse(process.argv); diff --git a/src/options.js b/src/options.js index 75f9cbe..e83b03c 100644 --- a/src/options.js +++ b/src/options.js @@ -23,6 +23,7 @@ function optionsFactory(name, counter = false, width = 1280, height = 800, + showMenuBar = false, userAgent, honest = false, callback) { @@ -63,6 +64,7 @@ function optionsFactory(name, counter: counter, width: width, height: height, + showMenuBar: showMenuBar, userAgent: userAgent };