Skip to content

darrellgum/claude-touch-bar

Repository files navigation

Claude Touch Bar

Monitor Claude Code's activity from your MacBook Pro Touch Bar — no need to keep the terminal visible.

It only took 10 years and an AI coding agent to finally justify that strip of OLED. A lightweight macOS utility that displays Claude Code's real-time working status (spinner, activity word, and color-coded state) directly in the Touch Bar Control Strip. Works across all apps — keep coding in your editor while Claude thinks in the background.

macOS Swift License

Why?

If you use Claude Code (Anthropic's CLI coding agent) on a MacBook Pro with a Touch Bar, you've probably found yourself switching back to Terminal just to check if Claude is still thinking, running a tool, or waiting for input. This solves that — a persistent glanceable status right in your Touch Bar.

What it shows

When Claude Code is working in Terminal.app, the Touch Bar displays:

  • Animated spinner + status word (e.g. ✶ Thinking…, ✻ Reading…) — matching Claude Code's own spinner characters and words exactly
  • Warm orange — Claude is actively working (receiving tokens)
  • Shifting to red — stalled (no new tokens for 3+ seconds), smoothly interpolated
  • Lighter warm — tool execution (reading files, running commands, etc.)
  • Gray — idle / ready

Tap the Touch Bar item to instantly bring Terminal.app to the foreground.

Requirements

  • MacBook Pro with Touch Bar (2016–2020 models)
  • macOS 12 Monterey or later (tested on macOS 26 Tahoe)
  • Xcode Command Line Tools (xcode-select --install)
  • Terminal.app running Claude Code

Compatibility

macOS Version Status
Tahoe 26 Tested, works
Sequoia 15 Should work (untested)
Sonoma 14 Should work (untested)
Ventura 13 Should work (untested)
Monterey 12 Minimum supported

The Touch Bar APIs (DFRFoundation) have been available since macOS 10.12.2, but the build targets macOS 12+ for Swift runtime compatibility. All Touch Bar MacBook Pros (2016–2020, Intel x86_64) are supported. If you test on a version marked "untested", please open an issue and let us know!

Quick start

git clone https://github.com/darrellgum/claude-touch-bar.git
cd claude-touch-bar
bash run.sh

That's it. The script builds the app and starts monitoring automatically.

How it works

Two components work together:

  1. ClaudeTouchBar.swift — A native Swift app that injects a custom item into the Touch Bar Control Strip using Apple's private DFRFoundation framework. It renders colored text on a black background and handles spinner animation, stalled detection, and smooth color transitions.

  2. claude-touchbar-bridge.sh — A bash bridge that reads Terminal.app's content via AppleScript, detects Claude Code's spinner state and working mode (thinking, tool-use, or responding), and writes status updates to /tmp/claude-touchbar-status.

The bridge polls Terminal every 300ms and classifies Claude's activity. The Swift app polls the status file and animates the Touch Bar with matching colors and spinner characters.

Color logic

The colors faithfully reproduce Claude Code's own terminal behavior:

State Color RGB
Active (thinking/responding) Claude orange (215, 119, 87)
Stalled (3s+ no new tokens) Shifts to red (171, 43, 63)
Tool execution Light shimmer (235, 159, 127)
Idle / ready Gray (120, 120, 120)

The stalled transition uses smooth easing (intensity += delta * 0.1 per 50ms tick), ramping from orange to red over 2 seconds after a 3-second inactivity threshold — exactly matching Claude Code's internal rendering logic.

Demo mode

To preview all states without running Claude Code:

bash claude-touchbar-bridge.sh demo

Manual build

bash build.sh
open ClaudeTouchBar.app

Files

File Purpose
ClaudeTouchBar.swift Touch Bar app (spinner, colors, stalled detection)
claude-touchbar-bridge.sh Terminal scraper (reads Claude Code status via AppleScript)
DFRPrivate.h Bridging header for Apple's private Touch Bar APIs
build.sh Compiles the Swift app into the .app bundle
run.sh One-command build + launch
ClaudeTouchBar.app/ macOS app bundle (required for system tray APIs)

Related

  • Claude Code — Anthropic's agentic coding tool
  • Claude — Anthropic's AI assistant

License

MIT

About

macOS Touch Bar status monitor for Claude Code — see spinner, working state, and color-coded activity (thinking/stalled/tool-use) at a glance, even while in another app. For MacBook Pro 2016-2020.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors