Package Exports
- menubar
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (menubar) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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 icon and this will handle opening/closing a window when you click/blur.
Works on Mac OS, Windows and some Linuxes (Tested on Xfce4, your mileage may vary -- patches welcome!)
Mac OS

Windows

Watch the 1HR screen recording of me coding this module: https://www.youtube.com/watch?v=PAJAvsyaHs0
This module was written for + is used by Monu
installation
npm install menubar --saveusage
create a JS program like this:
var menubar = require('menubar')
var mb = menubar()
mb.on('ready', function ready () {
console.log('app is ready')
// your app code here
})make sure there is also a index.html file in dir
then use electron or electron-packager to build/run the app:
$ npm install electron-prebuilt -g
$ electron your-app.jssee example/ for a working example
the return value of mb is an event emitter with these properties:
{
app: the electron require('app') instance,
window: the electron require('browser-window') instance,
tray: the electron require('tray') instance,
setOption(option, value): change an option after menubar is created,
getOption(option): get an menubar option,
showWindow(): show the menubar window,
hideWindow(): hide the menubar window
}options
you can pass an optional options object into the menubar constructor
dir(defaultprocess.cwd()) - the app source directoryindex(defaultfile:// + opts.dir + index.html) - the html to load for the pop up windowicon(defaultopts.dir + Icon.png) - the png icon to use for the menubartray(default created on-the-fly) - an electronTrayinstance. if providedopts.iconwill be ignoredpreloadWindow(default false) - Create BrowserWindow instance before it is used -- increasing resource usage, but making the click on the menubar load faster.width(default 400) - window widthheight(default 400) - window heightx(default OS X: centered under the tray icon. Windows: screen width (right)) - the x position of the windowy(default OS X: 0. Windows: screen height (bottom)) - the y position of the windowalways-on-top(default false) - if true, the window will not hide on blurshow-on-all-workspaces(default true) - Makes the window available on all OS X workspaces.
events
the return value of the menubar constructor is an event emitter
ready- when the app has been created and initializedcreate-window- the line before new BrowserWindow is calledafter-create-window- the line after all window init code is doneshow- the line before window.show is calledafter-show- the line after window.show is calledhide- the line before window.hide is called (on window blur)after-hide- the line after window.hide is called
