# Bar (/docs/haus/rooms/bar)



**The bar** replaces the macOS menu bar (hidden while this one is on) with
one in your palette, wired to your tiling.

```nix
haus.bar.enable = true;
```

## What's on it [#whats-on-it]

**Far left, the house**: [the logo pill](#the-logo-pill).

**Left, your workspaces**, one pill each, the focused one lit, the front app's
title beside it. Tap the Caps-Lock leader and the whole left side flips into
launcher letters. [Each pill tells you what's on it](#what-a-workspace-pill-says).
Three more come with [Windows](/docs/haus/rooms/windows):

* **The page.** A workspace with a `/` in its name (`T/haus`, an agent
  [lane](/docs/haus/rooms/development)'s) is a page. The pill names yours,
  and counts it: `3/4` when the workspace has more than one place to be,
  `T` itself being one of them whenever there is a window on it. On `T` it
  dims to that bare count (`4`), and it goes dark when `T` is all there is.
  Click for the **Pages** picker; ⇧ or right-click throws the focused window
  onto one. The leader's `t` returns to the page of `T` you used last.

* **The layout.** **Grid**, **Accordion** or **Columns**, whatever ⇪ then `.`
  [last dealt](/docs/haus/rooms/windows#spin-the-layout-until-its-right) this
  workspace, once two windows are tiled. Clicking it advances the dial.

* **Buried.** A floating window that has sunk behind your tiled windows.
  AeroSpace takes a floating window off the grid but not out of the stack, so
  the first tiled window you click covers it. When one on this workspace is
  less than a quarter visible, this pill shows its app's logo and name, with
  `+2` if two more are buried too, and clicking it brings that window back to
  the front.

**Right, the status cluster**, [toggled below](#toggling-pills).

## What a workspace pill says [#what-a-workspace-pill-says]

A pill with more than one window on it shows a pip per window:

| Pip | Window                                                          |
| --- | --------------------------------------------------------------- |
| `●` | tiled                                                           |
| `○` | off the grid: floating, minimised, or belonging to a hidden app |

So `1 ●●○` is two tiled windows and one that can get lost. Past six it
switches to the count (`7○`). A workspace's pages count toward its pill.
A pill with a ring around it is showing on your other display, even when
nothing is on it.

**Click the pill you're on** (or **right-click any pill**) for the list of
windows on that workspace, grouped by page. Each row names the app and the
window's title, with a badge for the state that's likely why you looked:
`behind`, `fullscreen`, `minimised`, `hidden`, `floating`. Click a row to
focus that window wherever it is. Clicking a pill you're not on takes you
there, to the page of it you used last.

```nix
haus.bar.workspaces.windows = "count";  # or "off"; "dots" is the default
haus.bar.workspaces.buried = false;     # no buried pill
```

## The logo pill [#the-logo-pill]

| Gesture         | What you get                                                                                                 |
| --------------- | ------------------------------------------------------------------------------------------------------------ |
| **Click**       | System Settings, Activity Monitor, Lock Screen, Nix Config, Haus Settings, Rebuild System, Reload SketchyBar |
| **⌘ click**     | `haus rebuild`, in a floating terminal                                                                       |
| **Right click** | The full palette, the same thing ⌘Space opens                                                                |

All three need the [launcher](/docs/haus/rooms/launcher);
`haus.bar.logo.gestures = false` makes the pill plainly not a button.

| Colour      | Meaning                                  |
| ----------- | ---------------------------------------- |
| Your accent | Everything is running                    |
| Yellow      | A newer haus: `haus update`              |
| Red         | Something is enabled but **not running** |

Red is the one worth having, since a dead bar keeps drawing its last frame;
the check is local, every five minutes. Yellow asks GitHub every half hour,
the one thing here that leaves your machine, so it's off until
`haus.bar.logo.updateCheck = true`.

```nix
haus.bar.logo.icon = "⌂";
haus.bar.logo.size = 25;        # ⌂ is thin; the default house glyph is 20
haus.bar.logo.color = "teal";   # else haus.theme.accent
```

## The media pill [#the-media-pill]

| Gesture     | What it does                               |
| ----------- | ------------------------------------------ |
| Left click  | The dropdown, scrubber included            |
| Right click | Play / pause                               |
| ⌥ click     | Next track                                 |
| ⇧ click     | Previous track                             |
| **⌘ click** | **Bring the tab making the sound forward** |
| Scroll      | Seek ±10s                                  |
| Hover       | Sweep a long title, once                   |

That ⌘ click is the answer to *something is making noise and I can't find the
tab*. Titles scroll only on hover, anything over twenty minutes counts
**down** (`-38m`) instead, and the pill hides when nothing is playing.

```nix
haus.bar.media.collapse = true;   # glyph only until you hover
haus.bar.media.width = 16;        # characters; 32 by default, a maximum
```

`haus.bar.media.marquee = false` clips instead of sweeping;
[`haus.appearance.reduceMotion`](/docs/haus/rooms/appearance#motion) sets that,
`haus.bar.calendar.marquee` and `haus.bar.logo.sweep` together.

## Toggling pills [#toggling-pills]

Every right-side pill is one boolean; `clock`, `weather`, `media`, `battery`
and `wifi` default on, the rest off. The exception is `factory`, which follows
[`haus.ai.enable`](/docs/haus/rooms/ai), the room that puts the binary behind it
on your `PATH`. A pill set `false` is never created.

```nix
haus.bar.items = {
  weather = false;
  cpu = true;
  caffeinate = true;
};
```

| Pill         | What it is                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `cpu`        | Load, graphed. Hover splits user from system; click names the apps responsible; right-click opens Activity Monitor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `memory`     | Memory in use, coloured by the kernel's pressure level, not the percentage.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `volume`     | Output volume and mute.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `calendar`   | Your next meeting, `in 12m · Design review`, filling the pill five minutes either side. **Right-click joins**; left-click opens the day.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `caffeinate` | A coffee cup: click for 1, 2, 4, 8 hours or until stopped; right-click allows sleep.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `factory`    | How much longer this Mac may keep landing pull requests unattended, beside the cup because the two answer the same question: what did I leave switched on, and when does it stop. It draws the time left, an infinity sign for a lease that runs until you revoke it, and its own glyph alone when none stands. Click for 4 hours, 12 hours, until revoked, or Revoke; right-click revokes. The one pill you get without asking: it comes on with [`haus.ai.enable`](/docs/haus/rooms/ai), because that room is what puts the binary here. Without `factory` on your PATH it hides rather than drawing a control for a missing tool. [Merging overnight](/docs/haus/night-shift) is the setup it belongs to. |
| `agents`     | [Agent](/docs/haus/rooms/ai) lanes and Claude Code desktop sessions: red when one is waiting on you, click to jump there.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `aiUsage`    | AI quota spent, for the client you last actually **used**; click for each provider's windows and reset times. Each capped model family gets a gauge of its own in there. Grey means old, not low.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `github`     | What's waiting on you, from `haus.bar.github.sources`: searches, the `ci` board, or your own command. The number is how many, the octocat how bad, and **red means a red default branch and nothing else**. Right-click refreshes; with the [AI room](/docs/haus/rooms/ai#when-github-goes-red) on, a stuck row gets **Fix with AI**. Needs the [Development room](/docs/haus/rooms/development)'s git, `gh auth login`, and `haus.git.org` or your own sources; with neither, the build fails.                                                                                                                                                                                                              |
| `trill`      | A bell for [trill](/docs/trill)'s inbox; right-click (or ⌥-click) shows only the questions waiting on you. Nothing without Trill.app, dim while its daemon is down.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `elgato`     | Toggles an Elgato Key Light.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `harvest`    | Harvest time tracking, from a credentials file you provide.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

`aiUsage`'s Claude row: the desktop app renders no statusline, so the row
rides the **terminal** client's login, which lasts about nine hours; past that
it greys until you run `claude` in a terminal. A `user:profile` token in
`~/.config/haus/claude-usage-token` (`umask 077`; `claude setup-token` won't
mint one) overrides it.

**The weekly limit can have a ceiling inside it.** A plan can cap a model family
within the weekly window, so that family is spent for the week while the weekly
gauge above it still reads a calm 50%. Today that is Fable on a Max plan, at up
to half the week. The dropdown draws each ceiling as its own gauge under the
weekly it comes out of, and a newly capped family appears on its own, with no
haus release.

It stays in the dropdown. The pill's own number is the worse of session and
weekly, and nothing else, because a spent ceiling is often the highest number on
your account and still stops nothing: every other model is right there. Those
gauges need the same account poll as the Claude row above, so no login means no
gauge, and an hour after the last answer they dim.

The **focus** pill rides `haus.focus.enable` instead; only its placement is a
bar setting. It shows the minutes left while a `focus 25` is running, and the
bare moon the rest of the time.

`caffeinate`'s engine is a command. It holds the Mac, not the lid; for a
closed laptop, [`haus.ai.keepAwake`](/docs/haus/rooms/ai#letting-a-run-finish):

```sh
awake 3h
awake indefinitely
awake off
```

With that option on, an agent mid-turn holds the Mac too and the cup says
`ai`; right-click releases only your own hold.

## Writing your own pill [#writing-your-own-pill]

A pill haus doesn't ship is `haus.bar.widgets`, in two sizes. A line of text:

```nix
haus.bar.widgets.backup = {
  command = "/etc/haus/backup-status.sh";
  interval = 300;
  icon = "󰁯";
};
```

One line on stdout is the label; print nothing and the pill hides for that
tick. `placement = "bottom-left"` puts it on the second bar.

For a dropdown, a gesture or a graph, write a **barlib widget** and name it
in `script`:

```nix
haus.bar.widgets.pomodoro = {
  script = ./pomodoro.sh;         # header and all
  style."icon.color" = "$TEAL";   # its own hue, and nothing else
};
```

[Writing a bar widget](/docs/haus/rooms/bar-widgets) is the whole contract.

A bundled pill takes only `interval` and `placement` here
(`haus.bar.widgets.weather.interval = 1800`); `haus.bar.items.<name>` is sugar
for `.enable`, `haus.bar.bottom.items.<name>` for `.placement`. Also refused
at build: `command` and `script` together, `icon` on a `script` widget, a
bottom placement without `haus.bar.bottom.enable`, and a name outside letters,
digits, `_` and `-`, or one the bar already uses. `permissions = [ "full-disk-access" ]` declares what
macOS will prompt for. Nothing requests it and nothing waits on it: while the
pill is switched on, each grant becomes a card in `haus permissions`, which is
where a person is told why the bar is asking. `network` is the one that draws
no card, because nothing on macOS gates the network behind a click.

Talk back to the bar through `$SB` from `~/.config/sketchybar/bar.sh`, never a
bare `sketchybar`, which always means the top bar: a pill moved to the bottom
one stops updating, with no error.

## A second bar along the bottom [#a-second-bar-along-the-bottom]

```nix
haus.bar.bottom = {
  enable = true;
  items = { weather = "left"; media = "center"; focus = "right"; };
};
```

A pill named here **moves**, never two copies; `true` means `"right"`. With
tiling off, windows run underneath it; the Dock shares that edge, so move or
hide it; and
`haus.bar.position = "bottom"` beside it is two bars in one place, which
rebuild warns about.

## Options [#options]

[Every setting, with types and defaults](/docs/haus/reference/options#bar).
