Skip to content
Simplifies BitBar app plugin creation
JavaScript TypeScript
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Meta tweaks Dec 16, 2019
.editorconfig Require Node.js 6 Nov 12, 2018
.gitattributes Require Node.js 6 Nov 12, 2018
.gitignore Require Node.js 6 Nov 12, 2018
.npmrc Require Node.js 6 Nov 12, 2018
.travis.yml Require Node.js 8 Jun 23, 2019
index.d.ts
index.js Meta tweaks Dec 17, 2019
index.test-d.ts Fix `text` option being mandatory in top-level options (#27) Dec 17, 2019
license Require Node.js 6 Nov 12, 2018
package.json 1.3.0 Dec 17, 2019
readme.md Meta tweaks Dec 16, 2019
screenshot.png init Jan 9, 2016
test.js Meta tweaks Dec 17, 2019

readme.md

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 bitbar

Usage

#!/usr/bin/env /usr/local/bin/node
const bitbar = require('bitbar');

bitbar([
	{
		text: '',
		color: bitbar.darkMode ? 'white' : 'red',
		dropdown: false
	},
	bitbar.separator,
	{
		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.separator,
	'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 of 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.separator

Add a separator.

bitbar.darkMode

A boolean of whether macOS Dark Mode is enabled.

You can’t perform that action at this time.