Manage multiple Claude Code accounts with usage tracking, load balancing, and a Cinnamon panel applet
This is a fork of can1357/c2switcher adapted for Linux Mint Cinnamon. The CLI tools work identically; the KDE Plasma widget has been replaced with a native Cinnamon applet.
| Retro (default) | Classic |
|---|---|
![]() |
![]() |
Live usage monitoring with color-coded indicators and one-click account switching Click the "Claude Switcher" title in the popup to toggle between themes
- Multi-account management - Add, remove, reorder, and edit accounts with nicknames
- Auto-detect new logins - Applet monitors
~/.claude/.credentials.jsonand auto-imports new accounts - Usage tracking - Monitor 5-hour, 7-day, and Sonnet usage limits with color-coded indicators
- Smart load balancing - Automatically picks the optimal account based on usage, drain rates, and active sessions
- Session-safe switching - Detects when Claude Code is actively processing and blocks switching mid-request
- Auto-switch on rate limit - When your current account hits 95%+ usage, automatically swaps to the optimal account between prompts or after the session ends
- Re-authentication detection - Accounts with expired or revoked tokens are flagged automatically. The applet shows a "Re-auth" button instead of usage badges, and switching to the account is blocked until credentials are refreshed via
c2switcher login - Active account indicator - Green dot and legend marker show which account Claude Code is currently using
- Session tracking - See which accounts are actively being used and where
- Dual themes - Retro-futurist purple (default) or classic orange — click the title to toggle
- Cinnamon panel applet - Monitor all accounts from your panel with one-click switching
- Usage caching - Respects rate limits with 5-minute cache
- Wrapper script -
c2claudecommand for seamless account switching
This tool uses undocumented OAuth API endpoints to fetch usage data and authenticate accounts. While Anthropic allows users to create multiple accounts (confirmed by multiple people who asked Anthropic Staff, including me), this implementation relies on reverse-engineered API endpoints that may change without notice.
If Anthropic would prefer this tool not exist, please reach out and I'll gladly take it down. I'm very compliant like that :)
- Linux Mint (Cinnamon edition) - tested on Mint 21.x / 22.x
- Python 3.7+
- Claude Code CLI installed and configured
- pipx (installed automatically by setup.sh, or:
sudo apt install pipx)
One-line install:
curl -fsSL https://raw.githubusercontent.com/incompletebiped/c2switcher-mint/master/setup.sh | bashOr clone and run interactively:
git clone https://github.com/incompletebiped/c2switcher-mint.git
cd c2switcher-mint
./setup.shThe interactive installer will ask what you want to install:
- CLI tools only
- CLI tools + Cinnamon applet
- Cinnamon applet only (if CLI already installed)
./setup.sh # Interactive mode
./setup.sh --all # Install everything (CLI + applet + status line)
./setup.sh --cli # CLI tools only
./setup.sh --applet # Cinnamon applet only (requires CLI)
./setup.sh --statusline # Claude Code status line only (requires CLI)
./setup.sh --uninstall # Remove everything- Right-click on your Cinnamon panel
- Click "Applets"
- In the applet list, find "Claude Code Usage"
- Click the + button (or toggle it on) to add it to your panel
The applet will appear on your panel showing the average Sonnet usage percentage.
# Recommended: OAuth login (opens browser)
c2switcher login --nickname main
# Add more accounts
c2switcher login --nickname work
c2switcher login --nickname personalOr import existing credentials from ~/.claude/.credentials.json:
c2switcher add --nickname main# Check that accounts are registered
c2switcher ls
# Fetch usage (the applet calls this automatically)
c2switcher usage
# Launch Claude with the optimal account
c2claudeThe panel applet should now show your usage data. Click it to see the full popup with per-account details.
Show the active c2switcher account and its usage directly in the Claude Code status bar. Updates live whenever you switch accounts.
./setup.sh --statuslineOr select option 3 (everything) or 5 (status line only) in interactive mode.
What it looks like:
[0] work 5h:42% 7d:18%
Usage percentages are color-coded to match the applet's thresholds (green / yellow / red). Only requires python3, which is already a c2switcher dependency.
Manual setup (if you prefer to do it yourself):
- Create
~/.claude/statusline-command.sh:
cat > ~/.claude/statusline-command.sh << 'STATUSLINE_EOF'
#!/usr/bin/env bash
cat > /dev/null # consume Claude Code's JSON input
RESET=$'\033[00m'
PURPLE=$'\033[38;5;141m'
GREEN=$'\033[38;5;82m'
YELLOW=$'\033[38;5;226m'
RED=$'\033[38;5;196m'
usage_color() {
local pct="${1%%%*}"; pct="${pct%.*}"
if [ "$pct" -ge 90 ] 2>/dev/null; then printf '%s' "$RED"
elif [ "$pct" -ge 70 ] 2>/dev/null; then printf '%s' "$YELLOW"
else printf '%s' "$GREEN"
fi
}
account=""
usage_str=""
if command -v c2switcher &>/dev/null; then
account=$(c2switcher current --format=prompt 2>/dev/null)
if [ -n "$account" ]; then
idx=$(c2switcher current --json 2>/dev/null | python3 -c \
"import sys,json; print(json.load(sys.stdin).get('index',''))" 2>/dev/null)
if [ -n "$idx" ]; then
usage_json=$(c2switcher usage --json 2>/dev/null)
if [ -n "$usage_json" ]; then
read -r five_h seven_d <<< "$(echo "$usage_json" | python3 -c "
import sys, json
data = json.load(sys.stdin)
idx = int('$idx')
for acc in data:
if acc.get('index') == idx:
u = acc.get('usage', {})
fh = u.get('five_hour', {}).get('utilization')
sd = u.get('seven_day', {}).get('utilization')
print(
(str(round(fh)) + '%') if fh is not None else '',
(str(round(sd)) + '%') if sd is not None else ''
)
break
" 2>/dev/null)"
if [ -n "$five_h" ] || [ -n "$seven_d" ]; then
[ -n "$five_h" ] && usage_str+="$(usage_color "$five_h")5h:${five_h}${RESET}"
[ -n "$five_h" ] && [ -n "$seven_d" ] && usage_str+=" "
[ -n "$seven_d" ] && usage_str+="$(usage_color "$seven_d")7d:${seven_d}${RESET}"
fi
fi
fi
fi
fi
if [ -n "$account" ]; then
line="${PURPLE}${account}${RESET}"
[ -n "$usage_str" ] && line+=" ${usage_str}"
printf '%s' "$line"
fi
STATUSLINE_EOF
chmod +x ~/.claude/statusline-command.sh- Add to
~/.claude/settings.json(replace/home/yournamewith your actual home directory):
{
"statusLine": {
"type": "command",
"command": "bash /home/yourname/.claude/statusline-command.sh"
}
}Panel icon: A system-monitor icon with your average Sonnet usage percentage, color-coded:
- Green (< 70%) - Plenty of headroom
- Yellow-orange (70-90%) - Getting close
- Red-orange (> 90%) - Nearly exhausted
Popup (click the icon):
- Header with refresh and optimal-switch buttons
- Sonnet usage bar - Full-width stacked segments showing each account's Sonnet utilization
- Overall usage bar - Full-width stacked segments showing each account's 7-day utilization
- Color legend with active account indicator (triangle marker)
- Account cards - One per account, showing:
- Active indicator (green dot for the currently active account)
- Index, nickname (editable via pencil icon), and email
- Four usage indicators: 5-hour, 7-day, Sonnet, and overuse rate
- Time-until-reset countdown in the indicator labels
- Re-auth button (replaces usage indicators when token is expired/revoked)
- Remove button (trash icon) to delete the account
- Hover tooltip with detailed reset times
- Click the "Claude Switcher" title to toggle between retro (purple) and classic (orange) themes
- Click an account card to switch to that account
- Click the star button to auto-switch to the optimal account (locked while Claude is processing)
- Click the refresh button to force a data update (menu stays open)
- Click the pencil icon on a card to edit the account nickname (Enter to save, Escape to cancel)
- Click the up/down arrows on a card to reorder account priority (affects load balancer round-robin)
- Click the trash icon on a card to remove the account from c2switcher (also clears credentials if it was the active account)
- Click the Re-auth button on a card with expired credentials to open a terminal and re-authenticate via
c2switcher login - Data auto-refreshes every 60 seconds
The applet detects whether Claude Code is actively processing by checking for established TCP connections from Claude's PIDs to non-localhost hosts (via ss):
| State | Optimal button | Manual card click |
|---|---|---|
| Claude idle at prompt | Unlocked (star icon) | Works |
| Claude streaming a response | Locked (lock icon) | Works (use at your own risk) |
| No Claude process running | Unlocked (star icon) | Works |
| Account needs re-auth | N/A | Blocked (Re-auth button shown instead) |
The lock icon updates live every time you open the applet menu. Accounts with expired tokens show a "Token expired" label and a Re-auth button in place of usage indicators — clicking the card body is suppressed until credentials are refreshed.
When the current account's usage reaches 95%+ (on either the 5-hour or 7-day Sonnet window), the applet automatically switches to the optimal account:
- Between prompts - If Claude is open but idle, credentials are swapped seamlessly before the next request
- After session ends - If Claude Code is fully closed, credentials are pre-positioned for the next session
- During processing - Auto-switch waits until the current request finishes
- 5-minute cooldown between auto-switches to prevent rapid back-and-forth
- Only triggers when there are 2+ accounts registered
The applet monitors ~/.claude/.credentials.json for changes. When a new login is detected (refresh token changes), the new account is automatically imported into c2switcher via c2switcher add. Regular token refreshes (same account, new access token) are ignored to avoid unnecessary API calls.
After pulling new changes:
./setup.sh --appletThen restart Cinnamon to pick up the changes: press Alt+F2, type r, and press Enter.
Applet shows "Error Loading Data":
Make sure c2switcher is installed and on your PATH:
c2switcher usage --jsonIf this command works in a terminal but the applet can't find it, check that the install path is in Cinnamon's PATH:
# Check where c2switcher is installed
which c2switcher
# Common locations that should be on PATH:
# /usr/local/bin/c2switcher
# ~/.local/bin/c2switcherApplet not appearing in the applet list:
Verify the files are in the right place:
ls ~/.local/share/cinnamon/applets/c2switcher@c2switcher-mint/
# Should show: applet.js metadata.json stylesheet.cssIf missing, re-run ./setup.sh --applet.
Applet not updating after upgrade:
Restart Cinnamon: Alt+F2 -> type r -> Enter.
Checking applet logs:
Open Cinnamon's Looking Glass debugger (Alt+F2 -> type lg -> Enter) and check the "Log" tab for errors containing c2switcher.
Option 1: OAuth Login (Recommended)
c2switcher loginOptions:
c2switcher login --nickname work # Login with a nickname
c2switcher login --manual-only # Disable localhost server
c2switcher login --no-browser # Don't auto-open browser
c2switcher login --no-add # Save creds but don't add to c2switcherOption 2: Import Existing Credentials
c2switcher add # Add current account
c2switcher add --nickname work # With a nickname
c2switcher add --creds-file ~/path/to/credentials.json # From a specific filec2switcher lsc2switcher nickname 0 "My Work Account" # By index
c2switcher nickname work "Work Pro" # By current nickname
c2switcher nickname user@email.com "Main" # By emailc2switcher remove 0 # By index (prompts for confirmation)
c2switcher remove work # By nickname
c2switcher remove user@email.com # By email
c2switcher remove 0 --yes # Skip confirmationIf the removed account is currently active in ~/.claude/.credentials.json, the credentials file is also cleared.
c2switcher usage # Rich table output
c2switcher usage --force # Bypass 5-minute cache
c2switcher usage --json # JSON output for scriptingColor indicators:
- Green (< 70%) - Plenty of headroom
- Yellow (70-90%) - Getting close
- Red (> 90%) - Nearly exhausted
c2switcher switch 0 # By index
c2switcher switch work # By nickname
c2switcher switch user@example.com # By emailc2switcher optimal # Auto-switch to best account
c2switcher optimal --dry-run # Show best without switching
c2switcher optimal --token-only --quiet # Get token for scriptsc2switcher cycle # Rotate to next accountc2switcher current
c2switcher current --format=prompt # For shell prompts: [0] main
c2switcher current --json# Session insights (top projects, daily cadence, heatmaps)
c2switcher report-sessions \
--db ~/.c2switcher/store.db \
--output ~/c2switcher_session_report.png \
--days 30 --min-duration 60
# Usage risk forecast (burn rates, reset timeline)
c2switcher report-usage \
--db ~/.c2switcher/store.db \
--output ~/c2switcher_usage_report.png \
--window-hours 24Add --show to display the figure after saving.
Combines account selection with running Claude Code:
c2claude # Use optimal account (default)
c2claude -0 # Use account 0
c2claude -1 # Use account 1
c2claude -a work # Use account by name/email/index
c2claude --cycle # Cycle to next account
c2claude -p "explain this" # Pass arguments to claudeThe wrapper handles session registration, load balancing, account stickiness, and cleanup on exit.
| Command | Aliases | Description |
|---|---|---|
login |
OAuth login and add account | |
add |
Import existing account credentials | |
remove |
Remove an account from c2switcher | |
nickname |
Set or update an account nickname | |
reorder |
Reorder accounts by specifying new order | |
ls |
list, list-accounts |
List all accounts |
usage |
Show usage across accounts | |
current |
Show currently active account | |
report-sessions |
Generate session analytics report | |
report-usage |
Generate usage risk forecast report | |
optimal |
pick |
Find and switch to optimal account |
switch |
use |
Switch to specific account |
cycle |
Rotate to next account | |
sessions |
List active sessions | |
history |
session-history |
Show past sessions with usage deltas |
force-refresh |
Force token refresh for account(s) |
| Command | Description |
|---|---|
start-session |
Register a new Claude session |
end-session |
Mark a session as ended |
All data is stored in ~/.c2switcher/store.db (SQLite):
- Account credentials and metadata
- Usage history with timestamps
- Session tracking (PID, working directory, duration)
Tokens are automatically refreshed when within 10 minutes of expiry. Force a manual refresh:
c2switcher force-refresh # All accounts
c2switcher force-refresh work # Specific accountAPI calls are cached for 5 minutes to avoid rate limiting. Use --force to bypass.
The optimal account selection uses a multi-factor scoring system:
- Drain rate (core metric) -
headroom / hours_until_resetwhere headroom = 99% - current utilization. Higher drain rate = more capacity available per hour = better candidate. - Window selection - Uses the Overall window (tier 2) while it has headroom, falls back to the Sonnet window (tier 1) when Overall is exhausted.
- Five-hour throttling - Penalizes accounts with high short-term usage to prevent burst rate limits. Score is halved at 90%+ five-hour utilization.
- Burst protection - Skips accounts where current usage + expected burst (based on historical deltas) >= 94%.
- Pace alignment - When Sonnet usage exceeds 90%, adjusts score based on whether usage is ahead of or behind the expected pace for the reset window.
- Session awareness - Among similar candidates, prefers accounts with fewer active and recent sessions.
- Round-robin - Accounts within 0.05 %/hr of each other are treated as equivalent and rotated fairly.
Accounts at 99%+ on both Sonnet and Overall windows are excluded entirely.
Each c2claude invocation registers a session, selects an account, runs Claude, and cleans up on exit. Dead sessions are auto-cleaned via multi-factor liveness checks.
| Path | Purpose |
|---|---|
~/.c2switcher/store.db |
SQLite database (accounts, usage, sessions) |
~/.c2switcher/load_balancer_state.json |
Round-robin state for fair rotation |
~/.c2switcher/.last_cleanup |
Session cleanup throttle marker |
~/.claude/.credentials.json |
Active Claude Code credentials |
~/.local/share/cinnamon/applets/c2switcher@c2switcher-mint/ |
Cinnamon applet files |
| Variable | Description |
|---|---|
DEBUG_SESSIONS=1 |
Enable verbose session tracking logs |
C2SWITCHER_DEBUG_BALANCER=1 |
Show detailed load balancer scoring |
All planned applet features are complete:
- Reorder account priority - Up/down arrows on each card to reorder accounts (affects load balancer round-robin)
- Re-authentication detection - Expired/revoked tokens are flagged with a Re-auth button; switching is blocked until credentials are refreshed
- Dual themes - Retro-futurist purple and classic orange, toggled by clicking the title
One-line uninstall (works from anywhere):
curl -fsSL https://raw.githubusercontent.com/incompletebiped/c2switcher-mint/master/setup.sh | bash -s -- --uninstallOr from a local checkout:
./setup.sh --uninstallOr manually:
# Remove CLI tools
pipx uninstall c2switcher
rm ~/.local/bin/c2claude
# Remove Cinnamon applet
rm -rf ~/.local/share/cinnamon/applets/c2switcher@c2switcher-mint/
# Remove all c2switcher data (optional)
rm -rf ~/.c2switcher/Re-running the installer overwrites the previous install:
curl -fsSL https://raw.githubusercontent.com/incompletebiped/c2switcher-mint/master/setup.sh | bashThen restart Cinnamon to reload the applet: Alt+F2 -> type r -> Enter.
Ensure the install location is on your PATH:
export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"Add to ~/.bashrc to make permanent.
If you see "Failed to refresh token" or an account shows the Re-auth button in the applet:
- Click the Re-auth button on the account card (opens a login terminal), or run manually:
c2switcher login
- Log in with the affected account — the existing account record is updated automatically by UUID match.
Verify Claude works: claude -p hi --model haiku
Dead sessions auto-cleanup, but you can check manually:
c2switcher sessions
DEBUG_SESSIONS=1 c2claude # Verbose session logginggit clone https://github.com/incompletebiped/c2switcher-mint.git
cd c2switcher-mint
pipx install --editable .
c2switcher --helpThe CLI entry point is c2switcher, and the Python package lives under c2switcher/. The Cinnamon applet source is in applet/.
Original project by can1357. Cinnamon applet port for Linux Mint.
Tip: Bind c2claude to a shell alias or keyboard shortcut for maximum laziness.

