This is bitbar, a library crate which includes helpers for writing BitBar plugins in Rust. BitBar is a system that makes it easy to add menus to the macOS menu bar. There are two apps implementing the BitBar system: SwiftBar and xbar. This crate supports both of them, as well as the discontinued original BitBar app.
There are two main entry points:
- It's recommended to use the
mainattribute and write amainfunction that returns aMenu, along with optionalcommandfunctions and an optionalfallback_commandfunction. - For additional control over your plugin's behavior, you can directly
DisplayaMenu.
BitBar plugins must have filenames of the format name.duration.extension, even though macOS binaries normally don't have extensions. You will have to add an extension, e.g. .o, to make Rust binaries work as plugins.
Example
use ;
Or:
use ;
There is also a list of real-world examples.