Skip to content

Instantly share code, notes, and snippets.

@sanappa
Last active May 27, 2019 17:49
Show Gist options
  • Save sanappa/ce493991316cf07d6fa1676c0e031daf to your computer and use it in GitHub Desktop.
Save sanappa/ce493991316cf07d6fa1676c0e031daf to your computer and use it in GitHub Desktop.
Option to set menubar visibility
diff --git a/README.md b/README.md
index d53fca8..239cf62 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,7 @@ prompt([options, parentBrowserWindow]).then(...).catch(...)
| useHtmlLabel | (optional, boolean) Whether the label should be interpreted as HTML or not. Defaults to false. |
| icon | (optional, string) The path to an icon image to use in the title bar. Defaults to null and uses electron's icon. |
| customStylesheet | (optional, string) The local path of a CSS file to stylize the prompt window. Defaults to null. |
+| menuBarVisible | (optional, boolean) Whether to show the menubar or not. Defaults to true. |
If not supplied, it uses the defaults listed in the table above.
diff --git a/lib/index.js b/lib/index.js
index e5f801a..2e79c75 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -22,7 +22,8 @@ function electronPrompt(options, parentWindow) {
selectOptions: null,
icon: null,
useHtmlLabel: false,
- customStylesheet: null
+ customStylesheet: null,
+ menuBarVisible: true
},
options || {}
);
@@ -48,6 +49,7 @@ function electronPrompt(options, parentWindow) {
});
promptWindow.setMenu(null);
+ promptWindow.setMenuBarVisibility(opts.menuBarVisible);
const getOptionsListener = event => {
event.returnValue = JSON.stringify(opts);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment