max-mapper / menubar

βž– high level way to create menubar desktop applications with electron
BSD 2-Clause "Simplified" License
6.68k stars 365 forks source link

GitHub Actions Workflow Status npm (scoped) Libraries.io dependency status for GitHub repo npm bundle size npm bundle size




βž– Menubar

High level way to create menubar desktop applications with Electron.




This module provides boilerplate for setting up a menubar application using Electron. All you have to do is point it at your index.html and menubar will handle the rest.

βœ… Only one dependency, and one peer-dependency.

βœ… Works on macOS, Windows and most Linuxes. See details.

βœ… πŸ’₯ 3.6kB minified + gzipped πŸ’₯

macOS Mojave 10.14 Windows 10 Ubuntu 18.04

Installation

yarn add menubar

Usage

Starting with your own new project, run these commands:

$ yarn add menubar
$ touch myApp.js
$ touch index.html

Fill index.html with some HTML, and myApp.js like this:

const { menubar } = require('menubar');

const mb = menubar();

mb.on('ready', () => {
  console.log('app is ready');
  // your app code here
});

Then use electron to run the app:

$ electron myApp.js

Alternatively, see examples/hello-world folder for a simple working example.

Menubar Class

The return value of menubar() is a Menubar class instance, which has these properties:

See the reference API docs.

menubar() Options

You can pass an optional options object into the menubar({ ... }) function:

See the reference API docs.

Events

The Menubar class is an event emitter:

Compatibility with Electron

menubar Electron Notes
9.x.x >=9.x.x <33.x.x
8.x.x 8.x.xx
7.x.x 7.x.xx
6.x.x >=4.x.x <7.x.x Not recommended for security reasons
<= 5.x.x <= 3.x.x Please, please don't use these old versions

API Docs

See the reference API docs.

Tips