Put anything in macOS menubar
Rudolf Jurišić
Posted on June 8, 2020
Run scripts in your favourite scripting language (PHP, Python, JS, Ruby, shell, Swift, Go, Perl, Lisp ...) and display output in macOS menubar. In no time.
BitBar is a macOS app that supports custom menubar apps by allowing you to load your scripts' output into macOS native menubar.
Setup
- Install BitBar (https://getbitbar.com/)
- Set plugin folder
- Download an existing plugin OR Create your own plugin (https://github.com/matryer/bitbar)
Existing scripts (Plugins)
You can download existing plugins from the Bitbar plugins repo. They even created a custom browser protocol (url schema bitbar://) so you can easily install the plugins. Plugins are your regular .js, .php., .sh, ... files.
Your own scripts
To create a plugin, just write an executable script that outputs to the standard output and put it in your BitBar plugin folder and make sure it's executable
Here’s a JavaScript example demonstrating basic visalization syntax:
#!/usr/bin/env /usr/local/bin/node
console.log(`🎩 Title`)
console.log(`---`) // separator
console.log(`🇭🇷 Menu item name | color=red `)
console.log(`--🐰 Submenu item | color=green`)
console.log(`Bitbar api docs | color=blue href=https://github.com/matryer/bitbar#plugin-api`)
Ideas
As you will see, there are a lot of plugins and if you need an inspiration browse the plugins repo.
There are a lot of integrations with known tools: Infrastructure (AWS, DigitalOcean, Heroku), productivity tools (Jira), Version Control tools (Github, Bitbucket, GitLab), CIs (Jenkins, CircleCI), Error reporting tools (Sentry) and so on.
Other than that, there are plugins for Cryptocurrencies, finance, music, weather and many many more.
What we used it for
We created a plugin for our internal time-tracking tool (Vremenco) and made it easy to track our work by enabling the interface in the menubar. Since we have an iOS department, we ended up using the native app. :)
Tips
- You can easily control the execution frequency (refresh rate) by naming your script file to match the time, e.g. test.1m.js which will run the script every 1 minute.
- use symlinks if you are actively working on your script
- there are some known issues, be aware
Conclusion
If you need some info always to be visible or a click away, this tool will give you that. It almost effortlessly provides you an environment to run your scripts. You do need to learn about formatting the output, but it is very easy and intuitive.
This is a quick and alternative way of building macOS menubar apps. You can also use Electron as another alternative method as opposed to writing native macOS apps which requires that specific stack knowledge.
What are your opinions?
What script would be a great candidate for putting in menubar?
Posted on June 8, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.