Giter Site home page Giter Site logo

menubar's Introduction

menubar

High level way to create menubar desktop applications with atom-shell

This module provides boilerplate for setting up a menubar application using atom-shell. 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.

Currently Mac OS only but patches welcome to add Windows/Linux support.

screenshot

Build Status

js-standard-style

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 --save

usage

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 atom-shell or atom-shell-packager to build/run the app

see example/ for a working example

the return value of mb is an event emitter with these properties:

{
  app: the atom shell require('app') instance,
  window: the atom shell require('browser-window') instance,
  tray: the atom shell require('tray') instance
}

options

you can pass an optional options object into the menubar constructor

  • dir (default process.cwd()) - the app source directory
  • index (default file:// + opts.dir + index.html) - the html to load for the pop up window
  • icon (default opts.dir + 'Icon.png') - the png icon to use for the menubar
  • tray (default created on-the-fly) - an atom shell Tray instance. if provided opts.icon will be ignored
  • width (default 400) - window width
  • height (default 400) - window height
  • x (default screen.workArea.width - opts.width - 200) - the x position of the window
  • y (default screen.workArea.y) - the y position of the window

events

the return value of the menubar constructor is an event emitter

  • ready - when the app has been created and initialized
  • create-window - the line before new BrowserWindow is called
  • after-create-window - the line after all window init code is done
  • show - the line before window.show is called
  • after-show - the line after window.show is called
  • hide - the line before window.hide is called (on window blur)
  • after-hide - the line after window.hide is called

menubar's People

Contributors

fritzy avatar maxogden avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.