Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Xbar: The BitBar reboot. Put anything in your macOS menu bar (xbarapp.com)
267 points by rjmunro on March 19, 2021 | hide | past | favorite | 51 comments


I've been discovering more and more high quality open source apps for Mac recently. My other favorites so far:

https://github.com/iterate-ch/cyberduck

https://github.com/rxhanson/Rectangle

https://github.com/sfsam/Itsycal

https://github.com/newmarcel/KeepingYouAwake


KeepingYouAwake is nice (and I'm not about to pretend the following solution is good for everyone), however, I've found on the last couple of McBook fresh installs using caffeinate [1] from the terminal is sufficient.

I usually have a terminal open anyway and `caffeinate -d -t 999999` usually does what I want (stay awake until I come back and tell you to go to sleep). Usually it's two keystrokes away (up arrow, enter), if not, that's quick enough to type for my purposes. That said, it's a bad approach if you want to suggest it as a tool for someone's workflow who _doesn't_ have a terminal open all of the time.

[1] https://ss64.com/osx/caffeinate.html


You can omit the -t and it will run forever.


I tend to use caffeinate to wrap scripts only. I want it to go to sleep and stop eating all my electricity when it’s done.


you can throw an alias in your .bashrc or .zshrc and have it even easier...

alias caffeine="caffeinate -d -t 999999"


I'm a huge, huge fan of hammerspoon. It's replaced so many other small utilities for me.


When I started using a Mac for work, the fact that so much functionality which is available free on Linux was now locked behind a paywall in the App Store was frustrating.

Hammerspoon gave me basically all of it back, in a scriptable form which makes it much better suited to what I want. It’s truly great software.


Yah I’ve been able to implement so many different features, and I love doing it myself not just because I don’t have to spend money on software (I’m perfectly willing to do that). I just hate having a myriad of single use third party utilities scattered around my hard drive and cluttering up my OS. I don’t know if I’ve just become more aware, or apps have gotten worse, but so many apps have opaque and undesirable behaviours / scopes nowadays.


Along the same vein, this was posted a little while back on HN which lists a few other ones that I have found useful.

https://onethingwell.org/


I've been using CyberDuck since PowerPC 10.5. I don't open it much any more because sftp feels like it takes less effort (despite the lack of autocomplete on Mac) but I do keep it installed. I can also vouch for ItsyCal, another one of the first things I install on a fresh Mac.


Thanks for this! I was going to mention Spectacle[0], but I'll see that it's no longer maintained. I'll have to check out Rectangle :)

EDIT: I see Rectangle is based on Spectacle!

[0] https://www.spectacleapp.com/


I also used to run Spectacle and was worried about it no longer working at some point (like after a macOS upgrade).

Rectangle is all that Spectacle was – same default key bindings – and more.


I would like to add stats[0] to the list, which is a great open source replacement for iStat Menus

[0] - https://github.com/exelban/stats


It's not open source but this is one of my favorites: https://www.monkeybreadsoftware.de/Software/IPinmenubar.shtm...


Related tip: if you hold Option and you click on the WiFi menu icon it'll show a detailed view which includes your local IP.


This can be done using xbar, trivially.


CyberDuck is amazing! (MountainDuck also) Thanks for recommending mate


How does it compare to Swiftbar[0]? Any reasons to use Xbar over SwiftBar given that the latter was built with a stack that is more "native" to Mac than Golang?

[0] https://github.com/swiftbar/SwiftBar


UPDATE: XBar is a reboot by the original creator of BitBar [2]. I understood it as I was confused why I have it in my starred. The below is my analysis before I understood it.

UPDATE 2: The authors of both also were considering to merge the projects. [3]

I see XBar seems to be more advanced and more popular.

It has these Advanced APIs like URL schema [0].

and also the GUI for plugins compared to Swiftbar

The tech stack of course is also much different as it's written in Go and Swiftbar as the name applies in Swift.

Although I like that SwiftBar has cron syntax support [1]. I didn't find a similar function in XBar.

A comprehensive comparison in one or the other's repo README could be useful

[0]: https://github.com/matryer/xbar#advanced-apis

[1]: https://github.com/swiftbar/SwiftBar#refresh-schedule

[2]: https://github.com/matryer/xbar/issues/607

[3]: https://github.com/matryer/xbar/issues/607#issuecomment-7752...


I was wondering about why SwiftBar existed when there was already BitBar, and a lot is explained in this thread on Github: https://github.com/swiftbar/SwiftBar/issues/95

TL;DR: BitBar stopped working well in Big Sur and the old code base was increasingly hard to update and build.


This was the first question that came to mind for me too.


One issue I've run into with BitBar is that you would need to install dependencies systemwide which I don't want to. A solution I found was to create a virtualenv for a specific script (or BitBar as a whole) and just put the path of the Python executable in the hashbang of the BitBar script, ie:

  #!/path/to/the/virtualenv/bin/python
There is no need to 'activate' the virtualenv or use some kind of wrapper (unless your script depends on PATH for subcommands to be executed from the virtualenv as well).


I can't find any reasons why it was rewritten.

Was it C before? (I can't tell, because https://github.com/matryer/bitbar redirects to xbar)


The old repo is archived in the new one https://github.com/matryer/xbar/tree/master/archive/bitbar



Note that this is a rewrite/reboot from the original BitBar that is still marked as beta but has very frequent releases.

There are more details about the motivations and such by the author in the announcement issue: https://github.com/matryer/xbar/issues/607



What do you use it for?

How does it compare to keyboard maestro?


I'm not the person you're asking, and I do most of my work on a PC running Linux now, but Hammerspoon is one of a few things I really miss about OSX.

I mostly used it to create small utility applications for the menu bar. Probably the most useful one was a Bitbucket pull request checker, which would monitor the status of open pull requests and display information about which PRs I hadn't yet viewed or approved, number of new comments since I last viewed the PR, build status etc. My job involves frequently reviewing PRs so this was really helpful for me.

I've tried rewriting this app for polybar on Linux but it's much more difficult to maintain, and sadly too much effort for me to bother with right now.

I haven't tried Keyboard Maestro - at a glance it looks really good, but doesn't appear to be open source like Hammerspoon. I can't tell whether it enables you to create stuff for the menu bar. I'm pretty sure Hammerspoon can do anything KM can, but I imagine KM is easier to use, particularly if you're not into programming.


BitBar is really cool. You can get something up and running in no time and it's fun to come up with some small personal automations.

On this topic, does anyone know simple way on Mac to display a multiline text input pop-up?

I'm playing with making a BitBar app that lets you keep a timesheet of what you've done today that syncs with a cloud API. I want a system tray icon that when you click it, it pops up with your notes so far that you can then edit and save your changes.

I know you can use osascript to create an ugly text input pop-up but it gets dismissed when you hit enter which I don't want. I'm looking for something lightweight to setup. Likely using Node but would rather not have to require Electron.


Just updated from BitBar and ran into a small issue since xbar doesn't support custom plugin folders the same way BitBar did (as in a way to change it via the GUI). Thankfully you can just symlink the plugin folder to your old BitBar folder and everything works as expected. I opened an issue for it here: https://github.com/matryer/xbar/issues/653


Bitbar-esque tools are fantastic. There are a wide variety on Linux, watching with slightly different formatting, but converting isn't a big pain. Being able to toss something together to display a portion of a curl call in a few minutes is great. I used to hate the top bar concept years ago when I was a windows user, but after switching to Unix for the past handful of years, I couldn't go back.


A couple of weeks ago I looked for a Bitbar alternative for Linux Mint/Cinnamon and there is really nothing. There's some implementation of the "Argos" app but it doesn't really work.


I love BitBar and currently have 6 separate tools in my menu bar to keep track of things like Kubernetes instances in various QA environments, local services running on my machine (with stats + start/stop buttons + recent logs), or jobs running on cloud platforms.

It's a fantastic tool and I'd encourage anyone who is thinking about building a tiny menubar app in just a few lines of code to look into it.


I personally use it just to display the currently playing track on Music--which actually solved a huge gap.

It was amazing to me that I couldn't find anything else to do just a basic "track playing" I could always see, without an always-on-top window blocking real estate. It seemed so obvious but nobody was offering that without adding a ton of other crap on top or making an intrusive windowed UI.

Then this little script executor with a per-menu output schema worked great. I was able to customize a basic "current track" script that either came with or was around as a plugin/sample and get it working to my exact spec within an hour.

What was especially awesome was when I moved to Catalina and the AppleScript targets changed from iTunes to Apple Music and broke automation, I was able to fix it in 30s by editing the script file for the new target name and it just worked. It was great to not have to wait on anyone else.

I'll definitely be trying the reboot.


Agree, I have it monitoring my AWS consumption cost and ETH prices. Pretty handy.


Would you mind sharing a code example of how you do this? It sounds very helpful



I'd suggest checking out jq for parsing JSON files:

    $ curl -s https://api.coinbase.com/v2/prices/ETH-USD/spot | jq -r .data.amount
    1675.55


Just download xbar, install some plugins through the included plugin browser, and check the source code. It's incredibly easy.

If you can echo something in a shell script you can echo it in the menu bar.


This is quite weird. Saw BitBar on here about five years ago and started using it. Then today, having upgraded to Big Sur recently, I noticed it didn't look right. The update didn't work either, so I went to find the repo and saw it was now called XBar. I upgraded and moved my scripts across and forgot about it.

Now what do I see when I come to HN for a quick break?

XBar. More proof that life is just a simulation.


My BitBar script displays the Unix epoch, comma separated:

    { 1,616,198,970 }
Script is 2 lines:

    EPOCH=$(/bin/date +%s | /usr/local/opt/gnu-sed/libexec/gnubin/sed ':a;s/\B[0-9]\{3\}\>/,&/;ta')
    echo "{" "${EPOCH}" "}"


I've been using barbly[0] which I wrote to scratch my own itch. It uses a JSON format for describing the menu bars which I found easier to work with. It's aesthetic is slightly different as well.

[0] https://github.com/luke-clifton/barbly


It would be awesome to find something similar to windows...I can imagine "boosting up" my taskbar with this kind of stuff. If anyone knows a similar app to Windows please let us know


In the future, xbar might be able to support Windows :)


Rainmeter is the closest thing to it.


Sup.


Sup.


Site is down :c 503


I like that they have some to show the number of unread Slack notifications, but the scripts are necessarily kind of hacky in order to deal with rate-limiting. It's ridiculous that Slack doesn't have such a feature built-in because people have been asking for it for years.


Doesn't fix it, but supposedly there's an undocumented api endpoint here: https://api.slack.com/api/client.counts?token=token_here

It will return "has_unreads=true" for channels that have unread notifications. So perhaps better than a naive brute force traversal.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: