BitBar (by Mat Ryer - @matryer) lets you put the output from any script/program in your Mac OS X Menu Bar.
Digging deeper:
And finally...
Example showing the latest Buy and Sell figures for BitCoins:
Click to see the full output, and more options:
Example showing your internal and external IP addresses:
Get the latest version of BitBar. Copy it to your Applications folder and run it - it will ask you to (create and) select a plugins folder, do so.
Browse our plugins to find useful scripts, or write your own.
If you love this, any BitCoin donations are most welcome, to 1DGoNEYAnjE5DqK7y5zMPR4PLU5HLKpLNR
or send something useful (Amazon Wishlist).
Just download the plugin of your choice into your BitBar plugins directory and choose Refresh
from one of the BitBar menus.
The refresh time is in the filename of the plugin, following this format:
{name}.{time}.{ext}
name
- The name of the filetime
- The refresh rate (see below)ext
- The file extensionFor example:
date.1m.sh
would refresh every minute.Most plugins will come with a default, but you can change it to anything you like:
Ensure the plugin is executable by running chmod +x plugin.sh
.
Because Git will ignore everything in Plugins/Enabled
, you can use it to maintain your own plugins directory while still benefitting from tracking (upstream) changes.
cd Plugins/Enabled
# Enable spotify plugin
ln -s ../Music/spotify.10s.sh
# Enable uptime plugin and change update interval to 30 seconds
ln -s ../System/uptime.1m.sh uptime.30s.sh
Then select the Enabled
folder in your BitBar preferences.
In case you made the mistake of choosing a directory with thousands of files as the plugin directory and BitBar getting stuck forever, do this from terminal to reset it:
defaults delete com.matryer.BitBar
git clone https://github.com/matryer/bitbar.git
pod
installed on your system using sudo gem install pod
make init
within the root of the projectopen App/BitBar.xcworkspace
Make sure you've all dependencies installed on your system by running make setup
.
make test
make watch
make test class=PropertyTest
or make watch class=PropertyTest
make lint
will display all linting errorsmake fix
will fix linting errorsmake release
We're always looking for new plugins, so please send us pull requests if you write anything cool or useful.
Join the conversation with plugin authors and BitBar maintainers on Slack.
If you've got ideas, or want to report a bug, nip over to our issues page and let us know.
If you want to contribute, please send us a pull request and we'll add it to our repos.
---
, the lines below it will appear in the dropdown for that plugin, but won't appear in the menu bar itself.--
will appear in submenus.~~~
from long running scripts to render everything above it and since the last ~~~
(example).Your lines might contain |
to separate the title from other parameters, such as...
href=..
to make the item clickablecolor=..
to change their text color. eg. color=red
or color=#ff0000
font=..
to change their text font. eg. font=UbuntuMono-Bold
size=..
to change their text size. eg. size=12
bash=..
to make the item run a given script terminal with your script e.g. bash=/Users/user/BitBar_Plugins/scripts/nginx.restart.sh
if there are spaces in the file path you will need quotes e.g. bash="/Users/user/BitBar Plugins/scripts/nginx.restart.sh"
param1=
to specify arguments to the script. additional params like this param2=foo param3=bar
full example bash="/Users/user/BitBar_Plugins/scripts/nginx.restart.sh" param1=--verbose
assuming that nginx.restart.sh is executable or bash=/usr/bin/ruby param1=/Users/user/rubyscript.rb param2=arg1 param3=arg2
if script is not executableterminal=..
start bash script without opening Terminal. true
or false
refresh=..
to make the item refresh the plugin it belongs todropdown=..
May be set to true
or false
. If false
, the line will only appear and cycle in the status bar but not in the dropdownlength=..
to truncate the line to the specified number of characters. A …
will be added to any truncated strings, as well as a tooltip displaying the full string. eg. length=10
trim=..
whether to trim leading/trailing whitespace from the title. true
or false
(defaults to true
)alternate=true
to mark a line as an alternate to the previous one for when the Option key is pressed in the dropdowntemplateImage=..
set an image for this item. The image data must be passed as base64 encoded string or URL and should consist of only black and clear pixels. The alpha channel in the image can be used to adjust the opacity of black content, however. This is the recommended way to set an image for the statusbar. Use a 144 DPI resolution to support Retina displays. The imageformat can be any of the formats supported by Mac OS Ximage=..
set an image for this item. The image data must be passed as base64 encoded string or URL. Use a 144 DPI resolution to support Retina displays. The imageformat can be any of the formats supported by Mac OS Xemojize=false
will disable parsing of github style :mushroom:
into :mushroom:ansi=false
turns off parsing of ANSI codes.checked=true
for a checkmarkTo enhance your entry on getbitbar.com, add the following metadata to your source code (usually in comments somewhere):
# <bitbar.title>Title goes here</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Your Name</bitbar.author>
# <bitbar.author.github>your-github-username</bitbar.author.github>
# <bitbar.desc>Short description of what your plugin does.</bitbar.desc>
# <bitbar.image>http://www.hosted-somewhere/pluginimage</bitbar.image>
# <bitbar.dependencies>python,ruby,node</bitbar.dependencies>
# <bitbar.abouturl>http://url-to-about.com/</bitbar.abouturl>
# <bitbar.droptypes>filenames,public.url</bitbar.droptypes>
# <bitbar.demo>--demo</bitbar.demo>
bitbar.title
- The title of the pluginbitbar.version
- The version of the plugin (start with v1.0
)bitbar.author
- Your namebitbar.author.github
- Your github username (without @
)bitbar.desc
- A short description of what your plugin doesbitbar.image
- A hosted image showing a preview of your plugin (ideally open)bitbar.dependencies
- Comma separated list of dependenciesbitbar.abouturl
- Absolute URL to about informationbitbar.droptypes
- Uniform type identifiers or filenames
, comma separated. Plugin is executed with arguments -type
and the dropped item(s) (example)bitbar.demo
- Whitespace separated arguments to execute plugin with in demo mode (i.e. when saving a screenshot)For a real example, see the Cycle text and detail plugin source code.
PATH
by including something like export PATH='/usr/local/bin:/usr/bin:$PATH'
in your plugin script.LANG
variable with: export LANG="es_ES.UTF-8"
(for Spanish) to show the text in correct format.bash=$0
#!/bin/bash
date
#!/bin/bash
# the current date and time
date
# the current username
echo $USER
# the current user id
id -u
#!/bin/bash
echo "One"
echo "Two"
echo "Three"
echo "---"
echo "Four"
echo "Five"
echo "Six"
#!/bin/bash
curl -m 1 http://example.com -I >/dev/null 2>&1
[ $? -gt 0 ] && echo "FAIL | color=red" || echo "OK | color=green"
echo "---"
echo "Show Graphs | color=#123def href=http://example.com/graph?foo=bar"
echo "Show KPI Report | color=purple href=http://example.com/report"
#!/bin/zsh
FONT=( 'size=14' 'font=UbuntuMono' )
if ((0)); then echo "DO | $FONT color=orange"
else echo "DO | $FONT color=cadetblue"
echo "---"
...
Anything that can write to standard out is supported, but here is a list that have been explicitly tested.
Ruby
puts "your string here"
Python2
print "your string here"
Python3
print("your string here")
JavaScript (node
)
Status: Working
Caveats: Shebang has to be in the format #!/usr/bin/env /path/to/the/node/executable
Output: console.log("your string here")
Notes:
process.stdout.write
doesn't output desired text.
There may be a better way to run JavaScript files.
Tips:
Use the Node.js bitbar
module to simplify plugin creation.
CoffeeScript (coffee
)
Status: Working
Caveats:
Shebang has to be in the format #!/usr/bin/env /path/to/the/coffee/executable
coffee
shebang also had to be modified.
#!/usr/bin/env /path/to/the/node/executable
Output: console.log "your string here"
Notes:
process.stdout.write
doesn't output desired text.
There may be a better way to run CoffeeScript files.
Swift (Interpreted)
print("your string here")
Swift (Compiled)
Status: Working
Caveats: You still need a file extension (file.1s.cswift
)
Output: print("your string here")
Notes:
To compile a swift file, use: xcrun -sdk macosx swiftc -o file.1s.cswift file.1s.swift
Go (Interpreted)
Status: Working
Caveats:
Your script's shebang must be: //usr/env/bin go run $0 $@; exit
go
must be in your PATH
Output: Println("your string here")
Go (Compiled)
Status: Working
Caveats: You still need a file extension (file.1s.cgo
)
Output: Println("your string here")
Notes
To compile a Go file, use: go build file.1s.go
Lisp
lisp
/clisp
must be in your PATH
(format t "your string here")
Perl5
Status: Working
Output: print "your string here"
Notes
Add -l
to shebang to automatic add newline to print function: #!/usr/bin/perl -l
PHP
Status: Working
Output: echo 'your string here'
Notes
Add shebang #!/usr/bin/php
Utilities:
BitBar PHP Formatter - https://github.com/SteveEdson/bitbar-php