Skip to content
NewA realistic 3D head for a free swim cap editor
Nov 20, 2026·4 MIN READ
All my Claude Code sessions in the Mac menu bar, one click from each window

All my Claude Code sessions in the Mac menu bar, one click from each window

I had 27 iTerm2 sessions open and no idea which Claude was waiting for me. A small SwiftBar plugin now lists them by state, and the hard part was not the list but jumping to a fullscreen window.

This morning I counted 27 iTerm2 sessions across 8 windows. Eight of them ran Claude Code. One was waiting for a permission prompt, and I only found it by clicking through windows. So I built a small menu bar item that answers one question: which Claude needs me now?

The data was already there

iTerm2 ships its own Claude Code hook, cc-status, and a CLI called it2. I already had the hook in my Claude Code settings, so every session reports a state: waiting, working, done or idle, plus a short status line. it2 session list --json gives every session, and it2 session get-status gives its state. The plugin only has to ask and print.

flowchart LR
    A["Claude Code hooks"] --> B["cc-status"]
    B --> C["iTerm2 session state"]
    C --> D["it2 CLI"]
    D --> E["SwiftBar plugin<br/>every 10 s"]
    E --> F["Menu bar 🤖 4 ⏳1"]

SwiftBar runs any script in a folder and turns its output into a menu. Mine is one Python file, iterm-sessions.10s.py. The 10s in the name is the refresh time. One run takes about 1.5 seconds, because it asks for 27 statuses in parallel.

Clicking a row was the real work

A list you can't click is only half the tool. I wanted a click to jump to that tab. It took five tries.

TryWhat it didResult
it2 session focusSelects the session inside iTerm2Window stayed behind
AppleScript select windowAsks iTerm2 to raise the windowIndex stayed at 7
it2 app activateiTerm2 activates itselfIgnored after a menu click
open -a iTermActivates through Launch ServicesiTerm2 in front, wrong window
Window menu item ⌥⌘NClicks it through System EventsWorks

The log file saved me here. Every click wrote a line, so I could see that the clicks arrived and every command returned 0. Nothing failed, the window just didn't move. Then it2 window list --json showed "is_fullscreen": true on most windows.

A fullscreen window on macOS is its own Space. iTerm2 can select a window on another Space, but it can't bring it to the front. The Window menu (⌥⌘1 to ⌥⌘9) can, because that is the same path a person takes.

The session variable \(tab.window.number) gives the number behind the shortcut. The click then runs a short AppleScript that finds the menu item ending in "⌥⌘N" and clicks it, and it2 session focus picks the right pane. SwiftBar needs Accessibility access for this, and it only reaches windows 1 to 9.

Three smaller traps

Empty folder

iTerm2 leaves session.path empty while Claude runs. I read the cwd of the claude process on the tab's tty with lsof instead.

No indent

SwiftBar trims leading spaces, wide ones too. A word joiner (U+2060) first keeps the spaces after it.

Pipe injection

SwiftBar reads | as the start of parameters. A folder name with a pipe could add a command, so every field is cleaned.

One more: SwiftBar runs every file in its plugin folder as a plugin. My AppleScript first lived in a separate file, so I moved it inside the Python script as a string.

What it took

About an hour and a half, most of it on the click. The list worked in the first ten minutes. If I did it again, I would check is_fullscreen before trying any focus command, and I would add the click log on day one instead of after the second "nothing happens".

Share
Mariusz Smenżyk
Written by

Mariusz Smenżyk

Builder for sport. Make. Test. Launch.

Related notes