Skip to content

About

A macOS menu bar window autopilot for multi-display vibe coding: one-hotkey focus/restore, Claude Code & Codex session hooks, terminal grids, session restore, and a CLI/HTTP/MCP agent API.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Vibe Focus app icon

Vibe Focus

Your windows, always in place.
A macOS menu bar window autopilot for multi-display vibe coding.

English · 简体中文

Release macOS 13+ Swift 5.9 License Website

Pressing Control-Q moves the active window to the main display and fills it

Vibe Focus is a lightweight macOS menu bar app that makes windows come to you instead of the other way around.

One hotkey moves the active window to the main display and fills the visible area; pressing it again restores the exact original position, size, and (with yabai) workspace. Beyond the manual shortcut, Vibe Focus can watch your Claude Code / Codex sessions and pull the matching terminal window forward the moment a response finishes — so you stop turning your head to check whether the AI is done.

It is not a tiling window manager and it does not take over your desktop. It is the small automation layer that removes the repetitive "find window → drag to main screen → resize → put it back" loop.


Why Vibe Focus

Multi-display work is full of low-frequency, high-interruption actions:

  • The AI finished on another screen. You keep glancing at the secondary display to see whether Claude Code / Codex has responded.
  • Demo or recording starts. The window you need is on the wrong display; you drag it over and resize it by hand.
  • Temporary focus has no way back. After a quick look, the original position and size are hard to restore precisely.
  • Native fullscreen is too heavy. It creates a separate Space; you just wanted one window, not a new desktop.
  • Window tools are either too manual or too invasive. Full tiling managers reorganize everything; plain shortcuts only cover half the job.

Vibe Focus keeps your layout intact and only moves the window you asked for — then puts it back exactly where it was.

Features

One-key focus and exact restore

Press ⌃Q to move the active window to the main display and fill its visible area. Press ⌃Q again to restore the recorded frame — position, size, and, when yabai is available, the original workspace. The record is persisted in SQLite, so relaunching the app does not forget the last moved window.

The move is designed to be atomic and animation-free: position and resize writes are combined, yabai's window animation is forced to 0.0 while Vibe Focus runs, and iTerm2 gets a dedicated single-frame cross-display channel via Apple Events (no "jump then grow" intermediate states). Other apps use the validated two-phase path.

AI sessions that come to you

Vibe Focus runs a local hook server (127.0.0.1:39277 by default) and understands the Claude Code / Codex hook lifecycle:

Event What Vibe Focus can do
SessionStart Bind session_id to the terminal window via TTY/PPID (or an SSH machine label for remote sessions)
Stop Pull the bound terminal window to the main display when a response completes (opt-in)
SessionEnd Pull the bound window to the main display when the session ends (opt-in)
UserPromptSubmit Keep the window in place when you press Enter at the terminal; restore it when the submission came from the input bubble
Notification Post a macOS notification when Claude is waiting for permission or input (on by default once the hook server is enabled)

Bindings are per session, so several Claude Code instances can run in parallel without stealing each other's windows. The hook server is off until you enable it in Settings; window-pulling triggers are separately opt-in.

Type without switching windows

Press ⌃X to open the input bubble. Type the prompt where you are, and Vibe Focus injects it into the target terminal in one shot — no focus switch, no per-keystroke lag on SSH sessions. The bubble supports live Markdown rendering, ↑/↓ history, a ⌘Y history panel, per-window drafts, and an Accessibility write-back check before submitting so long prompts are not lost between "pasted" and "sent".

Organize terminals into a grid

Create an n×m terminal grid on a chosen display or workspace, or capture the terminals you already arranged. Grids remember their positions and Claude sessions, and can be restored later with claude --resume. Grid creation and session restore currently support Terminal.app and iTerm2; other terminal windows can still be moved and focused individually.

Restore a whole multi-display session

Capture the current terminal layout across displays, workspaces, windows, and panes, then rebuild it after a restart or reconnect. Session restore uses yabai for cross-space discovery, enumerates panes through Terminal/iTerm2, and can locate local or remote (ssh) sessions and resume them.

See where every window lives

The screen minimap overlay shows the window distribution on each display in real time. Space badges label each screen with a "display-slot" index, so you can tell at a glance which workspace a window belongs to. Both are optional and can be toggled from Settings.

Work across displays and remote machines

Vibe Focus handles same-display moves, cross-display moves, and cross-workspace moves (the latter via yabai). For remote work, a small forwarder on the SSH host sends hook events back to your Mac, so a Claude Code session running on a remote machine can still pull its local terminal window forward.

Fix permissions instead of fighting them

Accessibility permission is required to control other apps' windows. Vibe Focus includes a Doctor view (--diagnose) and a lightweight AX probe (--check-ax) that report the real permission state, installation identity, login item, hook connection, and hotkey status. It also self-heals common authorization races and tells you when a reinstall changed the app's code signature.

Agent-native control

Every GUI action has an agent equivalent. The same capability layer is exposed through three channels:

  • CLI — VibeFocusHotkeys status, windows list, windows move-main, grid create, snapshot capture/restore, notify, settings get/set, and more.
  • HTTP API — GET/POST http://127.0.0.1:<port>/api/v1/*, authenticated with X-VibeFocus-Token.
  • MCP — a VibeFocusMCP stdio bridge exposes vibefocus_* tools to Claude Code and Codex (bundled with source installs).

Agent access is off by default. Enable it in Settings → Agent 接入 (Agent Access) to allow read-only queries; window operations, window creation, and settings writes each have their own additional toggle. The API binds to loopback only and never follows LAN mode.

Supported apps

Capability Support
Move / focus / restore any standard window Any macOS app with an Accessibility-controllable window
Claude Code / Codex session binding Terminal.app, iTerm2, Warp, Ghostty, Alacritty, kitty, WezTerm, Hyper, Tabby, VS Code, Cursor
Terminal grid and session restore Terminal.app and iTerm2 (AppleScript automation); layout capture also needs yabai
Single-frame cross-display move iTerm2 (Apple Events); other apps use the two-phase path
Cross-workspace move / minimap / session restore Requires yabai

Install

Requirements

  • macOS 13 Ventura or later
  • Accessibility permission (required to move other apps' windows)
  • Xcode Command Line Tools with Swift 5.9+ (only needed when building from source)
  • Optional: yabai for cross-workspace and session-restore features

Option A — Download a release

  1. Download VibeFocus-<version>-macos.zip from GitHub Releases.
  2. Unzip it and drag VibeFocus.app into /Applications (or run it from anywhere).
  3. If Gatekeeper blocks the first launch, right-click the app → Open once.

The current release asset targets Apple Silicon (arm64). Intel Macs can build from source with the steps below.

Option B — Build from source

git clone https://github.com/vibe-coding-labs/vibe-focus.git
cd vibe-focus
./install.sh

install.sh is a thin alias for run.sh, which is the single source of truth for build, bundle assembly, signing, and restart:

./run.sh            # build release → install to ~/Applications/VibeFocus.app → sign → restart
./run.sh --direct   # run the bare binary without installing a bundle

For stable Accessibility authorization across updates, create the local code-signing identity once:

bash scripts/setup_local_codesign.sh

If the certificate is missing, run.sh falls back to ad-hoc signing and warns you; macOS may then require re-checking Accessibility after each update.

First launch: grant Accessibility

  1. Launch VibeFocus.app. The app lives in the menu bar — no main window appears.
  2. Open System Settings → Privacy & Security → Accessibility.
  3. Click +, press ⌘⇧G, and enter:
    ~/Applications/VibeFocus.app
    
  4. Select VibeFocus.app and enable it.
  5. The default hotkey ⌃Q is ready immediately.

The first time you create a terminal grid or restore a session, macOS may also ask for Automation permission to control Terminal/iTerm2. That is expected.

Usage

Default shortcuts

Shortcut Action
⌃Q Move the active window to the main display and fill it; press again to restore
⌃X Open the input bubble
⌃T Edit the current terminal window title
⌃⌥← / ⌃⌥→ Left half / right half
⌃⌥↑ / ⌃⌥↓ Top half / bottom half
⌃⌥U / ⌃⌥I / ⌃⌥J / ⌃⌥K Four quarters
⌃⌥Return Maximize
⌃⌥C Center
⌃⌥N Move to the next display

Every shortcut can be re-recorded in Settings → 通用 (General) for the main hotkey, or Settings → 编排 (Orchestration) for layout shortcuts, with built-in conflict checks against common system shortcuts.

Menu bar

Click VibeFocus in the menu bar to access:

  • Toggle (⌃Q) — the same focus/restore action
  • Layout (摆位) — all placement actions
  • Terminal Grid (终端网格) — create, capture, or restore a grid
  • Settings… (设置…) — hotkeys, integrations, automation, appearance
  • Quit

AI session automation

To let Claude Code or Codex drive Vibe Focus:

  1. Open Settings → Claude 集成 (Claude Integration) or Settings → Codex 集成 (Codex Integration).
  2. Enable the local hook server and install the hooks with the one-click button. The installer writes the hook command and keeps credentials in ~/.vibefocus/hook-config.json (mode 0600).
  3. Choose which events should move windows:
    • Stop — response completed
    • SessionEnd — session ended
    • UserPromptSubmit — restore only for input-bubble submissions; terminal Enter keeps the window in place
  4. For remote sessions, install the forwarder on the SSH host and map its machine label to a local window.

No file is modified without your action: Vibe Focus shows the exact command and lets you install/uninstall it from the settings page.

Agent access

CLI

The app binary doubles as an agent CLI. windows list and sessions list read locally without credentials; commands that need the running app are forwarded to it and require the corresponding Agent Access permission. The executable is named VibeFocusHotkeys in a source-installed bundle and VibeFocus in the downloaded release bundle.

VibeFocusHotkeys status
VibeFocusHotkeys windows list
VibeFocusHotkeys windows move-main --id 3220
VibeFocusHotkeys windows layout --preset leftHalf
VibeFocusHotkeys grid create --rows 2 --cols 3
VibeFocusHotkeys snapshot capture --name before-refactor
VibeFocusHotkeys snapshot restore --id <snapshot-id>
VibeFocusHotkeys notify --text "Build finished"
VibeFocusHotkeys settings get
VibeFocusHotkeys settings set --key sound.volume --value 0.5

Exit codes are part of the contract: 0 success, 2 usage error, 3 app unreachable, 4 invalid token, 5 permission denied, 6 operation failed.

HTTP API

The hook server also exposes the command API:

TOKEN=$(python3 -c 'import json;print(json.load(open("$HOME/.vibefocus/hook-config.json"))["token"])')

curl -s -H "X-VibeFocus-Token: $TOKEN" http://127.0.0.1:39277/api/v1/status
curl -s -H "X-VibeFocus-Token: $TOKEN" http://127.0.0.1:39277/api/v1/windows
curl -s -X POST -H "X-VibeFocus-Token: $TOKEN" -H "Content-Type: application/json" \
  -d '{"windowId":3220}' http://127.0.0.1:39277/api/v1/windows/move-main

The API is loopback-only. It is intentionally never exposed on 0.0.0.0, even when LAN mode is enabled; remote agents should use an SSH tunnel.

MCP

Open Settings → Agent 接入 (Agent Access) and register the MCP bridge for Claude Code or Codex. This writes a vibefocus entry to the host's MCP configuration and exposes tools such as:

  • vibefocus_status, vibefocus_settings, vibefocus_settings_set
  • vibefocus_windows_list, vibefocus_window_move_main, vibefocus_window_focus, vibefocus_window_layout, vibefocus_window_float
  • vibefocus_sessions_list, vibefocus_snapshots_list, vibefocus_snapshot_capture, vibefocus_snapshot_restore
  • vibefocus_grid_create, vibefocus_space_switch, vibefocus_notify

The VibeFocusMCP bridge is bundled when installing with ./run.sh; the current release zip ships only the main app, so use a source install if you want MCP.

Troubleshooting

The hotkey does nothing

  1. Check Accessibility and run the diagnostic (this works for both bundle layouts):
    APP="/Applications/VibeFocus.app"   # source install: ~/Applications/VibeFocus.app
    BIN="$APP/Contents/MacOS/$(defaults read "$APP/Contents/Info" CFBundleExecutable)"
    "$BIN" --check-ax
    "$BIN" --diagnose
  2. Confirm the app is running:
    ps aux | grep -E "VibeFocus(Hotkeys)?"
  3. Open Settings → 通用 (General) and inspect the Doctor/status section.
  4. Try the menu bar Toggle (⌃Q). If the menu works but the hotkey does not, the cause is usually Accessibility or a shortcut conflict.

Accessibility is granted, but Vibe Focus still reports no permission

This usually means the permission record points at a different copy or an older code signature:

tccutil reset Accessibility com.openai.vibe-focus
open /Applications/VibeFocus.app   # source install: open ~/Applications/VibeFocus.app

Then re-enable VibeFocus.app in System Settings → Privacy & Security → Accessibility.

A window refuses to move or restore

Some system windows and native fullscreen windows cannot be moved directly. Vibe Focus fills the visible area rather than creating a native fullscreen Space; for cross-workspace moves and full session restore, install yabai and grant it Accessibility permission.

Logs and data

Path Contents
~/Library/Logs/VibeFocus/vibefocus.log Main log
~/Library/Logs/VibeFocus/vibefocus-events.jsonl Structured events
~/.vibefocus/vibefocus.db Window bindings, toggle records, audits
~/.vibefocus/hook-config.json Hook port and token (keep private)

Quit

Use VibeFocus → Quit, or:

killall VibeFocus VibeFocusHotkeys 2>/dev/null || true

Development

This repository builds with Swift Package Manager and a Command Line Tools toolchain. It uses a custom test runner because CLT-only environments do not ship XCTest.

# Build
swift build

# Run the app from source (installs a bundle and restarts it)
./run.sh

# Run the standalone test suite
bash Tests/run_all_tests.sh

# Primary assertion baseline (fast; run before merging)
swift run VibeFocusTestRunner

# Coverage pipeline
bash scripts/coverage_test_runner.sh
python3 scripts/coverage_report.py coverage.lcov --root .

The website lives in website/:

cd website
npm install
npm run dev
npm run build

See CONTRIBUTING.md and AGENTS.md for project conventions. On macOS, display-sleep can truncate window-server queries; run long test/coverage sessions under caffeinate -d.

Project layout

.
├── Sources/
│   ├── App/                  # App lifecycle, menu bar, login item, sounds
│   ├── AppEntry/             # Main executable entry and CLI dispatch
│   ├── Api/                  # Agent API, MCP protocol, permissions, onboarding
│   ├── Bubble/               # ⌃X input bubble, drafts, history
│   ├── Hook/                 # Claude Code / Codex hook server and handlers
│   ├── HotKey/               # Global hotkey capture and conflict checks
│   ├── Layout/               # Placement presets and their hotkeys
│   ├── MCPBridge/            # VibeFocusMCP stdio bridge
│   ├── Overlay/              # Minimap and space index overlays
│   ├── Screen/               # Screen geometry and work-area learning
│   ├── SessionRestore/       # Multi-display / workspace session snapshots
│   ├── Settings/             # SwiftUI settings UI
│   ├── Space/                # macOS Space control (yabai integration)
│   ├── Support/              # Logging, persistence, signing, diagnostics
│   ├── TerminalGrid/         # Terminal grid creation and restoration
│   ├── TitleEditor/          # Terminal window title editing
│   ├── Toggle/               # Focus / restore engine
│   └── Window/               # Window discovery, AX/AX write, movement
├── Tests/
│   ├── Runner/               # VibeFocusTestRunner (primary assertions)
│   ├── Standalone/           # Dependency-free logic tests
│   └── XCTest/               # XCTest suites (full Xcode)
├── docs/                     # Architecture, runbooks, quality ledgers
├── website/                  # Product site (React + Vite)
├── assets/                   # Icons and brand assets
├── scripts/                  # Build, packaging, coverage, diagnostics
├── install.sh                # Alias for run.sh
├── run.sh                    # Build → install → sign → restart
└── CHANGELOG.md

Documentation

Contributing

Issues and pull requests are welcome. Please read CONTRIBUTING.md first, keep changes focused, and include the macOS version, Vibe Focus version, and reproduction steps in bug reports.

License

Apache License 2.0 © Vibe Focus contributors.

About

A macOS menu bar window autopilot for multi-display vibe coding: one-hotkey focus/restore, Claude Code & Codex session hooks, terminal grids, session restore, and a CLI/HTTP/MCP agent API.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages