node package manager

bitbar

bitbar Build Status

Simplifies BitBar app plugin creation

Create your plugin using a nice API instead of having to manually construct a big string.

Requires BitBar 1.9 or higher.

Install

$ npm install --save bitbar

Usage

#!/usr/bin/env /usr/local/bin/node
const bitbar = require('bitbar');
 
bitbar([
    {
        text: '',
        color: bitbar.darkMode ? 'white' : 'red',
        dropdown: false
    },
    bitbar.sep,
    {
        text: 'Unicorns',
        color: '#ff79d7',
        submenu: [
            {
                text: ':tv: Video',
                href: 'https://www.youtube.com/watch?v=9auOCbH5Ns4'
            },
            {
                text: ':book: Wiki',
                href: 'https://en.wikipedia.org/wiki/Unicorn'
            }
        ]
    },
    bitbar.sep,
    'Ponies'
]);

Create a file with the above code in the BitBar plugins directory and make sure to chmod +x filename.js it. Read more.

Change /usr/local/bin/node to the path of your Node.js binary. This is a known issue in BitBar.

API

bitbar(items, [options])

items

Type: Array<string|Object>

An item can be a string with the text or an object with the text in a text property and any of the options. The text can be multiple lines, but for the first item, only the first line will be shown in the menubar.

submenu

Type: Array<string|Object>

It will add a submenu to the current item. A submenu is composed by an array of items.

options

Type: Object

You can use any of the supported options.

Applies to all items unless overridden in the item.

bitbar.sep

Add a separator.

bitbar.darkMode

Returns a boolean of whether macOS Dark Mode is enabled.

License

MIT © Sindre Sorhus