Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove menubar from Finder in Electron on OSX

I purchased a new macbook and I am now working on getting my apps to run on a 64bit mac.

However I haven't been able to remove the default menubar.

Is there anyway to change my app name from Electron to something else within Electron via app.js so I don't see Electron in Finder (revert to screenshot for better understanding)? Is there any way to remove the edit, view window, and help menus?

screenshot

package.json:

{
  "name": "hello",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "start": "electron ."
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "electron-prebuilt": "^0.33.0"
  }
}

app.js:

var app = require("app"),
        BrowserWindow = require("browser-window");

app.on("ready", function() {
  var mainWindow = new BrowserWindow({
    toolbar: false,
    "skip-taskbar": true,
    "auto-hide-menu-bar": true,
    width: 800,
    height: 600
  });

  mainWindow.loadUrl("file://" + __dirname + "/index.html");
  mainWindow.setMenuBarVisibility(false);
  mainWindow.setAutoHideMenuBar(true);
  mainWindow.openDevTools();
});

index.html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Hello</title>
  </head>
  <body>
    Hello world!
  </body>
</html>
like image 755
Michael Schwartz Avatar asked Sep 17 '15 18:09

Michael Schwartz


People also ask

How do I remove the menubar from my Electron?

To remove menu bar from Electron app, we can set the autoHideMenuBar to true . to create a BrowserWindow instance by passing in an object with autoHideMenuBar set to true . As a result, the menu bar would be hidden in the app.

How do I get rid of menu bar on Mac?

On your Mac, use Dock & Menu Bar System Preferences to change the appearance of the Dock, and to select items to show in the menu bar and in Control Center. To change these preferences, choose Apple menu > System Preferences, then click Dock & Menu Bar .

How do I remove icons from status bar Mac?

Remove or Reorder Icons Using Command ⌘ Drag You can drill down to the panel for each icon and uncheck a box for the icon if you want to remove it from the Menu bar. A faster way to do this is using Command (⌘ Key on your Mac) key and then dragging the icons you want to remove off the Menu bar.

Where is menubar in Mac?

The menu bar runs along the top of the screen on your Mac. Use the menus and icons in the menu bar to choose commands, perform tasks and check status. You can set an option to automatically hide the menu bar so it's shown only when you move the pointer to the top of the screen. See Change Dock & Menu Bar preferences.


1 Answers

After you create your browser window do the following:

mainWindow.setMenu(null);

Only works for Windows and Linux! - http://electron.atom.io/docs/api/browser-window/#winsetmenumenu-linux-windows

Otherwise you can create a custom menu of your own by checking out Electron's documentation on the Menu: http://electron.atom.io/docs/api/menu/.

like image 92
Shawn Rakowski Avatar answered Sep 16 '22 13:09

Shawn Rakowski