Skip to content

feat: add macOS menu bar wrapper (contrib) - #8

Open
anlvdt wants to merge 29 commits into
Pimpmuckl:mainfrom
anlvdt:feat/macos-menubar-wrapper
Open

feat: add macOS menu bar wrapper (contrib)#8
anlvdt wants to merge 29 commits into
Pimpmuckl:mainfrom
anlvdt:feat/macos-menubar-wrapper

Conversation

@anlvdt

@anlvdt anlvdt commented Jun 13, 2026

Copy link
Copy Markdown

Summary

A lightweight Python menu bar app that wraps the codex-account-switcher CLI, providing a native macOS menu bar experience for quick account switching — no TUI needed.

menu bar

Features

  • ⚡ Persistent menu bar icon showing current account name
  • One-click switching — click any saved account to switch instantly
  • Auto Codex restart — kills and relaunches Codex after switching
  • Non-destructive Add Account — login with a new account without losing the current one
  • Usage/quota display — see remaining weekly % per account
  • Auto-start on login — via macOS LaunchAgent

How it works

The wrapper calls codex-account-switcher CLI commands (status --json, list --json, save, activate, delete) under the hood, so all auth management is handled by the existing Rust implementation.

Files

contrib/macos-menubar/
├── README.md              # Documentation
├── codex_switcher.py      # Main menu bar app (rumps)
├── requirements.txt       # Python deps (rumps)
└── setup.sh               # Install script (venv + LaunchAgent)

Install

cd contrib/macos-menubar
chmod +x setup.sh
./setup.sh

Requirements

  • macOS 13+, Python 3.9+
  • codex-account-switcher CLI on PATH

Menu

Item Action
email@example.com Current active account
other@example.com Click to switch
💾 Save Current Account Snapshot current auth
🔑 Add New Account… Non-destructive add flow
🗑 Delete Account Remove saved snapshot
🔄 Refresh Reload menu

Motivation

Many macOS users prefer a persistent menu bar icon over a TUI for quick account switching. This wrapper provides that experience while leveraging the existing CLI for all auth operations.

A lightweight Python menu bar app using rumps that wraps the
codex-account-switcher CLI for a native macOS menu bar experience.

Features:
- ⚡ persistent menu bar icon showing current account
- One-click account switching with auto Codex restart
- Non-destructive 'Add New Account' flow
- Delete saved snapshots from menu
- Auto-start on login via LaunchAgent
- Usage/quota display per account

Files:
- contrib/macos-menubar/codex_switcher.py — main app
- contrib/macos-menubar/setup.sh — install script (venv + LaunchAgent)
- contrib/macos-menubar/requirements.txt — deps (rumps)
- contrib/macos-menubar/README.md — documentation
@Pimpmuckl

Pimpmuckl commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Since this is python and would introduce a dependency I would say it makes most sense to keep it in your own fork for now.

This way the releases can simply be installed stand-alone, the python wrapper would complicate that.

And since this is 100% Rust for now, I'd like to keep it that way. In case you want to re-do that in rust, you're more than welcome to open another PR!

The feature is, of course, great though!

anlvdt and others added 27 commits June 25, 2026 09:04
…polish

Add native tray Add New Account session, regenerate macOS icons and app
packaging scripts, and improve quota UX (Past reset label, auto-refresh
wording). Auto-switch now refreshes usage before switching, notifies even
when Codex is closed, and runs an immediate check when enabled from tray.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add budget-based pick-best switching inspired by community tools, plus
login/save, current, rename labels, JSON import/export bundles, switch
activity logging, tray best-quota action, and startup usage refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>
Expose refresh-usage CLI, TUI actions for batch quota refresh, best-quota
switch, and account labels, plus ZIP import/export via bundle.json archives.

Co-authored-by: Cursor <cursoragent@cursor.com>
External volumes may not be mounted when LaunchAgents run at login; wait
for the binary and bootstrap the agent so startup registration sticks.

Co-authored-by: Cursor <cursoragent@cursor.com>
Score switch targets by remaining quota, reject rate-limited or stale
cache entries, and only switch when the target materially improves on
the current account. Add near-limit threshold and adaptive poll settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
Defer auto-switch while Codex is running, add Cancel/Wait/Switch now
prompts in TUI and tray, fix tray icon lifecycle with detached spawn and
background tasks, and add open-menubar.command launcher.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Duplicate tray spawns and binaries on external volumes caused silent exits.
Install a boot-volume copy, detach with setsid, flock the tray lock, and
restart via pid-aware launcher instead of broad pkill.

Co-authored-by: Cursor <cursoragent@cursor.com>
… exits

Point LaunchAgent at the installed menubar binary, ensure launchctl bootstrap
when enabled, stop open-menubar from killing a live tray, and wait up to 120s
for Codex to finish before urgent quota auto-switches.

Co-authored-by: Cursor <cursoragent@cursor.com>
…h UX

Ship a local web Overview + popover dashboard, Cursor/Claude usage and
cookie import, and process handling only at switch time (no always-on
blockers banner). Fix Claude tray quota when live identity has no email,
and prefer non-blocking status polls for keychain/CLI timeouts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants