
BitBar: put the output from any script/program in your Mac OS X Menu Bar - trueduke
https://github.com/matryer/bitbar
======
jtokoph
As my way of playing around with what BitBar can do, I created a Spotify
script. Until it's merged you can check out the pull request:
[https://github.com/matryer/bitbar/pull/34](https://github.com/matryer/bitbar/pull/34)

Shows current track name and artist in menu bar. Shows track/artist/album in
dropdown along with play/pause/next/previous buttons.

Raw script here: [https://raw.githubusercontent.com/jtokoph/bitbar/jtokoph-
spo...](https://raw.githubusercontent.com/jtokoph/bitbar/jtokoph-
spotify/Plugins/Media/spotify.10s.sh)

~~~
onion2k
Very nice, but none of the multiline bits after the pipe works for me (might
be Bitbar rather than your script though).

EDIT: The reason for this is the version installed by brew is 1.2, and that
bug was fixed in 1.3.1.

~~~
matryer
Can someone help on this?
[https://github.com/matryer/bitbar/issues/64](https://github.com/matryer/bitbar/issues/64)

~~~
onion2k
That's fixed it ... just needed to update brew and do a "brew cask install
--force bitbar" to update. Now it's working. Cheers!

------
sciencerobot
Awesome tool! I've always wanted to make menubar apps but never wanted to
learn Xcode+ObjectiveC.

Related:

Is there no simple way to get the current temperature for location based off
of GeoIP using `curl`?

I had to use this monstrosity to get the current temperature:

    
    
        #!/bin/bash
    
        export PATH='/usr/local/bin:$PATH'
    
        ansiweather -a off -l 'San Francisco' \
          | cut -d '>' -f 2 \
          | cut -d '-' -f1 \
          | awk '{ print $1 $2 }' \
          | tr -d 'C'

~~~
taylorzane
You could use OpenWeatherMap's API. Something like this is pure (remove the
`&units=imperial` if you prefer Celsius):

    
    
        curl -s "http://api.openweathermap.org/data/2.5/weather?zip=$(curl -s ipinfo.io/postal),us&appid=2de143494c0b295cca9337e1e96b00e0&units=imperial" \
          | sed -e 's/\(.*\)temp":\([0-9.]*\),\(.*\)/\2/'
    

or you could replace the `sed` pipe with a call to `jq`:

    
    
        curl really_long_url | jq '.main.temp'

~~~
mkagenius
> remove the `&units=imperial` if you prefer Celsius

That would get you Kelvin, use `&units=metric` for Celsius

~~~
taylorzane
Good call! I completely forgot the default units were in Kelvin, and not
Celsius.

------
nikisweeting
Looks very similar to:
[http://sveinbjorn.org/platypus/](http://sveinbjorn.org/platypus/)
([http://sveinbjorn.org/files/manpages/PlatypusDocumentation.h...](http://sveinbjorn.org/files/manpages/PlatypusDocumentation.html#235))

BitBar focuses on just the Menu Bar use case though, and does a more polished
job than Platypus.

~~~
jamessb
Also AnyBar, which displays a coloured dot in the menu bar:
[https://github.com/tonsky/AnyBar](https://github.com/tonsky/AnyBar)

Or TextBar, which is a $3 utility:
[http://www.richsomerfield.com/apps/](http://www.richsomerfield.com/apps/)

------
zepolen
I've been using
[https://github.com/jaredks/rumps](https://github.com/jaredks/rumps) for this
sort of thing.

~~~
subnaught
Another vote for rumps.

------
djhworld
I just wrote a plugin to allow me to set my Network location (we sit behind a
corporate proxy at work) AND my bash proxy settings at the same time.

So when I'm not in the office switching to my "home" profile is just a menu
click away.

This has been a long standing dream of mine to automate - so thanks!

EDIT: also it works with emojis, which is handy, here's a screenshot
[http://imgur.com/CVxchnI](http://imgur.com/CVxchnI)

~~~
daturkel
I hope you submitted a pull request!

~~~
djhworld
Sadly it's too bespoke to release, I had all the profile switching scripts
written already and have been using them for a few years now. On top of
updating environment variables with proxy settings etc, they also update a
bunch of configuration files for maven, ssh, stunnel etc via symlinks

All this bitbar thing does is call those existing scripts, very simple, but
saves me

a) wondering what profile I have enabled (now in the menubar) b) opening a
terminal and typing "update-env (work|home)" (one click switch)

------
javajosh
Could also use Hammerspoon
([http://www.hammerspoon.org/](http://www.hammerspoon.org/)) for this. It uses
Lua but you can invoke processes and modify the toolbar. In addition you can
hook into keystrokes, do window management, and all kinds of stuff.

~~~
cmsj
and the upcoming 0.9.44 release will be even more flexible for this sort of
use, because the process invoking stuff
([http://www.hammerspoon.org/docs/hs.task.html](http://www.hammerspoon.org/docs/hs.task.html)
) will support processes that run indefinitely, so you could do crazy stuff
like have a menubar item that shows the most recent line of a log file, or
whatever you want :)

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

~~~
iaw
This should be somewhere in the documentation if it's not already.

~~~
soheil
Done
[https://github.com/matryer/bitbar/pull/33/files](https://github.com/matryer/bitbar/pull/33/files)

~~~
mintplant
It would be good to sumbit a ticket for the original hanging bug as well, if
one doesn't already exist.

~~~
matryer
Would this involve a timeout or maximum plugin count? Something like that?
Please do open a ticket.

~~~
mikeash
Ideally, the scanning process would be asynchronous so that the program would
remain responsive and you could retarget it within the app.

------
seanwilson
This is a great idea; looks really practical and easy to extend. Is there a
list of more plugins anywhere? There's only a few in the repo:
[https://github.com/matryer/bitbar/tree/master/Plugins](https://github.com/matryer/bitbar/tree/master/Plugins)

------
evanb
This reminds me of geektool
[http://projects.tynsoe.org/en/geektool/](http://projects.tynsoe.org/en/geektool/)
which seems like it may have been abandoned? It was one of my favorite tools.

~~~
provemewrong
A bit more modern and customizable alternative is Übersicht. Widgets are
created in HTML5 and CoffeScript.

[http://tracesof.net/uebersicht/](http://tracesof.net/uebersicht/)

~~~
binaryapparatus
Last time I checked this tool they didn't support multiple monitors. Is that
fixed now?

Also big minus was menu bar icon, such tools don't need one.

~~~
provemewrong
I only use one though, so I can't say for sure but judging by their blog posts
they offer to choose which monitor Ubersicht runs on, but I believe it can't
be displayed on multiple monitors at the same time. That's true about the
menubar icon, but it doesn't bother me.

------
zlalanne
For i3, i3blocks does the same job:

[https://github.com/vivien/i3blocks](https://github.com/vivien/i3blocks)

~~~
rasur
Why thank you, I use i3 (i love it) and this will be very useful.

------
enedil
And nobody is restricted to shell scripts. Any program that writes to STDOUT
will work.

------
benwills
I won't be able to get to tinkering with this for a couple weeks, but if it
does what it says it does, I've been wanting almost exactly this for a very
long time. Thanks for getting it out there.

------
ghoul2
I made something quite similar a while ago for Linux (Cinnamon).

[https://github.com/abgoyal/ShellToolsApplet](https://github.com/abgoyal/ShellToolsApplet)
[http://cinnamon-spices.linuxmint.com/applets/view/136](http://cinnamon-
spices.linuxmint.com/applets/view/136)

------
mofle
I made a Node.js module with a nice API for it to ease plugin creation:
[https://github.com/sindresorhus/bitbar](https://github.com/sindresorhus/bitbar)

------
dmsimard
Sweet. Does anyone happen to know if there is something similar for gnome-
based environments on Linux ?

~~~
tbrock
Conky is great for this sort of thing.

~~~
rovr138
I haven't used conky in a while, but can you interact with it now?

I was checking the plugins and some of them allow clicking on items in the
dropdown and having an action execute.

The clipboard history now has code for this.

------
vanous
The issue i can see in gnome-shell (on linux) implementations is that long
running script can block the UI. Async script execution, on the other hand,
exhaust open file resources due to non closed file descriptors. Do OSX tools
like this suffer the same problem?

------
pinkunicorn
This is fantastic, I wanted to donate - but do not have a Bitcoin wallet. Any
other options?

~~~
matryer
You're too kind - these words are enough. But if you insist, I do need some
socks :) [http://amzn.to/1Pd9yOt](http://amzn.to/1Pd9yOt)

------
lambrettaman
I'm missing something. I have it installed. My plugins are executable. I've
Reset. I've changed the folder. But BitBar says "No Plugins Found"

~~~
lambrettaman
Must be a Mac thing. I downloaded the .zip file and the plugins work.

------
rrggrr
I almost bought TextBar (www.richsomerfield.com). You for saved me $2.99 and 5
minutes of time. I'm disproportionately grateful for this.

------
daemonk
Nice. There are already a couple of programs that do this I think, but maybe
use AWS CLI to write a plugin for monitoring ec2 instances' status.

------
luke-stanley
Anyone know how to do similar for Xfce or LXDE?

~~~
thwarted
XFCE has an applet called "generic monitor" that can be used for this.

~~~
pentlander
There's also a lightweight menu bar for X11 systems called bar.
[https://github.com/LemonBoy/bar](https://github.com/LemonBoy/bar)

------
chinchang
Amazing!!!!! Thanks for this :)

------
reacweb
Very nice. Does anyone have entry points to do the same with gnome 3 ?

~~~
vanous
See this two comments of mine. Perhaps time to study these and make a nice
universal, working extension.

[https://news.ycombinator.com/item?id=10843704](https://news.ycombinator.com/item?id=10843704)
[https://news.ycombinator.com/item?id=10841525](https://news.ycombinator.com/item?id=10841525)

------
vowelless
Anyway I can hook up custom keyboard shortcuts to BitBar scripts?

~~~
matryer
Nice idea - you should raise an issue:
[https://github.com/matryer/bitbar/issues](https://github.com/matryer/bitbar/issues)

------
daviddoran
Very clever approach, I like the simple text-based format.

------
daturkel
This is awesome. Can't wait to see more plugins.

~~~
matryer
Me too :) We didn't have to wait long - check these out:
[https://github.com/matryer/bitbar-plugins](https://github.com/matryer/bitbar-
plugins)

Some of them are like full apps in their own right.

------
dannyrosen
Anyone know of a solution like this for KDE Plasma?

