barrs is a native macOS status bar for Rift.
It is built as a lightweight bar daemon with a Rust core, a native AppKit renderer, built-in system plugins, and direct Rift integration. The current focus is a practical top bar for daily use on macOS rather than SketchyBar compatibility.
- Native macOS renderer
- Tight Rift workspace and layout integration
- Built-in plugins for CPU, GPU, battery, time, and date
- Hover tooltips and click handlers
- Lua configuration
- Homebrew installation and
launchdservice support
- macOS
- Rift, if you want workspace and layout items
This repository can be used as a tap. Because the repository is named barrs
rather than homebrew-barrs, use the explicit URL form:
brew tap TudorAndrei/barrs https://github.com/TudorAndrei/barrs
brew install barrsYou can also install the formula directly:
brew install --formula https://raw.githubusercontent.com/TudorAndrei/barrs/main/Formula/barrs.rbcargo build --releaseThe binary will be available at:
target/release/barrsStart barrs as a user service:
brew services start barrsUseful service commands:
brew services restart barrs
brew services stop barrsYou can still interact with the running daemon directly:
barrs status
barrs reload
barrs dump-state
barrs stopFor development, run it directly from the repository:
cargo run -- start --config barrs.luaIn debug builds, start stays attached to the terminal so you can iterate
without a detached background process.
Install the pinned tools, then run all tests:
mise install
mise run testmise run test runs unit tests with cargo-nextest, then
runs the Cucumber features and documentation tests with Cargo. The Cucumber
targets use a custom test harness and return no tests when Nextest lists them.
Documentation tests need a separate Cargo command.
mise run check also checks formatting, lints, and all targets. CI and the
release checks run the same three test commands.
The features in tests/features/ describe the behavior of barrs in Gherkin:
tests/features/config/loads Lua configs (tests/config.rs).tests/features/daemon/starts thebarrsbinary with the no-op renderer and drives it with thebarrscommands (tests/daemon.rs).
Run unit tests with cargo nextest run --locked.
Run one domain with cargo test --test config or cargo test --test daemon.
Add -- --name <regex> to run matching scenarios only.
On first start, barrs creates a default config at:
~/.config/barrs/barrs.luaYou can also point it at an explicit config file:
barrs start --config /path/to/barrs.luaThe repository includes a sample config at barrs.lua.
Configuration is written in Lua and currently covers:
- bar appearance
- global item spacing
- item order and placement
- icons and labels
- per-item refresh intervals with
interval - built-in plugin bindings
- Lua update functions that set item text
- hover tooltips
- click and hover handlers
Items can be placed in three sections with placement:
leftmiddleorcenterright
Omitting placement defaults to left. Left items flow from the left edge,
right items flow inward from the right edge, and middle/center items are
centered in the available bar space. On built-in Mac displays with a notch,
middle items are split around the reserved notch gap so they do not render under
the notch.
Assign global Lua function names in an item's handlers table. Each slot is
called for its matching event:
| Handler slot | Event value |
|---|---|
click |
click |
right_click |
right_click |
scroll |
scroll |
hover_enter |
hover_enter |
hover_leave |
hover_leave |
hover_update |
hover_update |
The bar sends hover_update when the pointer moves over the item it
hovers; a pointer that does not move sends no update.
Each function receives one ctx table:
{
item_id = "time",
event = "click",
timestamp_ms = 0,
mouse = { x = 0, y = 0, button = nil, scroll_delta = nil },
modifiers = {
shift = false,
control = false,
option = false,
command = false,
},
}mouse.button is present for pointer buttons, mouse.scroll_delta is present
for scroll events, and both are otherwise nil. Handler return values are
ignored. A configured handler name must exist when the config is loaded. If a
handler raises an error while processing an IPC request, the daemon returns an
error response and the CLI exits nonzero; errors from native renderer events
are logged by the daemon. A handler that runs longer than 1 second is stopped
with an error. The daemon does not wait for a handler: it queues the call on
the Lua thread and keeps serving the bar and IPC requests. An item trigger
request gets its reply when the handler ends, so it can wait behind a running
update function. Hover state on the bar changes at once, before the hover
handler runs.
The bundled sample records the most recent time-item event in Lua state without launching external programs:
function record_time_event(ctx)
last_time_event = ctx.event
endA lua plugin sets an item's text from a global Lua function. The daemon calls
the function named by update when the config loads, every interval seconds
(default: 5), and directly after a handler of that item processes a click,
right click, or scroll:
function memory_usage(ctx)
local pipe = io.popen("memory_pressure")
local output = pipe:read("*a")
pipe:close()
local free = tonumber(output:match("free percentage: (%d+)%%"))
return { text = (100 - free) .. "%", free = free }
end
return {
items = {
{
id = "memory",
interval = 5,
plugin = { kind = "lua", update = "memory_usage" },
},
},
}Each call receives ctx = { item_id = "memory", timestamp_ms = 0 }. Return a
string, or a table with a string text. The other fields of the table stay in
the item data that barrs dump-state shows. The result must be smaller than
16 KiB as JSON.
Update functions and event handlers run on one Lua thread and share Lua globals,
so the bar and IPC requests stay responsive while a function runs. Only one call
per item runs at a time. A function that raises an error, returns an invalid
value, or runs longer than 5 seconds makes the item show — until its next
successful call. The time limit counts Lua instructions, so it cannot stop a
function that waits inside one C call, such as a long io.popen or
os.execute. Each reload starts a new Lua thread with fresh globals.
The bar also accepts SketchyBar-style notch settings:
bar = {
spacing = 0,
background = "#000000",
notch_width = 200,
notch_padding = 8,
notch_offset = 0,
notch_display_height = 0,
}notch_width is the physical horizontal notch width used on notched built-in
displays. notch_padding adds clearance on each side of that width (default:
8), preventing icons from sitting flush against or clipping beneath the notch.
notch_offset shifts the native top bar frame vertically on built-in displays,
and notch_display_height overrides the bar window height when set to a value
greater than 0.
Built-in time, date, cpu, gpu, and battery items now refresh
automatically with sane defaults. Set interval on an item to override that
default. Example:
{
id = "time",
icon = "",
placement = "middle",
interval = 1,
plugin = { kind = "time" },
}The date plugin uses Jiff's strftime format rules.
Omit format to use %Y-%m-%d. Both time and date use the system time zone.
Jiff does not use the system locale; weekday and month names are in English.
Invalid format directives return an error. Output has no fixed byte limit.
Example:
{
id = "date",
icon = "",
plugin = { kind = "date", format = "%Y-%m-%d" },
}The bundled default config also sets explicit intervals for cpu, gpu,
battery, time, and date.
cpugpubatterytimedaterift_workspacesrift_layoutlua(see Lua update functions)
barrs start
barrs stop
barrs reload
barrs status
barrs ping
barrs validate-config --config /path/to/barrs.lua
barrs dump-state
barrs rift backend
barrs item trigger <item-id> <event>Releases are automated from conventional commits on main with
cog bump --auto. Cocogitto derives the next SemVer version, updates
CHANGELOG.md and Cargo metadata, and creates the release
commit and matching v{{version}} tag.
Install the local release tooling with mise:
mise installPreview the next automatic version:
mise run release-planFrom a clean main working tree, execute the reviewed release:
mise run release-autocog.toml configures the release. Before the release commit, its
pre-bump hooks set the Cargo version, run the tests, and check that
barrs --version prints the new version. After the commit, it pushes main
and the v{{version}} tag to origin. Nothing is published to crates.io.
After the tag is pushed, GitHub Actions builds the macOS archives, publishes the
GitHub release assets, and updates Formula/barrs.rb.
Do not hand-edit the version in Cargo.toml or create tags manually.
- The bar is top-mounted only.
- Release installs are designed to run as a service.
- Development runs stay in the foreground.
- Rift-backed items use the direct Mach backend when available and fall back to the CLI backend otherwise.