- Download
.config__ccstatusline__settings.jsonto~/.config/ccstatusline/settings.json - Download
bashScripts__ccstatusline-usage.shto~/bashScripts/ccstatusline-usage.sh
Last active
February 6, 2026 15:18
-
-
Save fcamblor/0ad17cab5cc797d9e92d0620be795f99 to your computer and use it in GitHub Desktop.
My custom Claude Code StatusLine settings (for Mac)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": 3, | |
| "lines": [ | |
| [ | |
| { | |
| "id": "3", | |
| "type": "context-length", | |
| "color": "brightBlack" | |
| }, | |
| { | |
| "id": "0c199d1c-30ab-4750-889c-1f20bdfe0370", | |
| "type": "context-percentage", | |
| "backgroundColor": "bgYellow", | |
| "metadata": { | |
| "inverse": "false" | |
| } | |
| }, | |
| { | |
| "id": "502d9f6f-2f4a-4dab-b698-f27b67e28e4c", | |
| "type": "model", | |
| "backgroundColor": "bgBrightBlue" | |
| }, | |
| { | |
| "id": "91fe07b8-6e3e-4fc4-b8f0-1e86e225fdbc", | |
| "type": "block-timer", | |
| "backgroundColor": "bgBrightMagenta" | |
| } | |
| ], | |
| [ | |
| { | |
| "id": "123be3ac-5e8e-41df-800a-2ece070a2570", | |
| "type": "current-working-dir", | |
| "backgroundColor": "bgMagenta" | |
| }, | |
| { | |
| "id": "38c8a1a1-4e57-4549-8cf6-2d9299f4f5ed", | |
| "type": "git-worktree", | |
| "backgroundColor": "bgWhite" | |
| }, | |
| { | |
| "id": "ecb97f54-78ef-4af7-a47d-ef3de5c5bdcc", | |
| "type": "git-branch", | |
| "backgroundColor": "bgBrightBlack" | |
| }, | |
| { | |
| "id": "28fb19a1-785a-4420-a0ad-18b42638995c", | |
| "type": "git-changes", | |
| "backgroundColor": "bgBrightGreen" | |
| } | |
| ], | |
| [ | |
| { | |
| "id": "70bfc662-91c7-447a-a050-49af6d6bba67", | |
| "type": "session-cost", | |
| "backgroundColor": "bgBrightMagenta" | |
| }, | |
| { | |
| "id": "7e896e34-9ef0-4f8d-afde-1d4e45b71fee", | |
| "type": "session-clock", | |
| "backgroundColor": "bgMagenta" | |
| }, | |
| { | |
| "id": "a19499a4-41f4-4f46-b8e7-e71314312d7c", | |
| "type": "custom-command", | |
| "backgroundColor": "bgBrightWhite", | |
| "commandPath": "~/bashScripts/ccstatusline-usage.sh" | |
| } | |
| ] | |
| ], | |
| "flexMode": "full-minus-40", | |
| "compactThreshold": 60, | |
| "colorLevel": 3, | |
| "defaultPadding": " ", | |
| "inheritSeparatorColors": false, | |
| "globalBold": false, | |
| "powerline": { | |
| "enabled": true, | |
| "separators": [ | |
| "" | |
| ], | |
| "separatorInvertBackground": [ | |
| false | |
| ], | |
| "startCaps": [ | |
| "" | |
| ], | |
| "endCaps": [ | |
| "" | |
| ], | |
| "theme": "solarized", | |
| "autoAlign": false | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #set -x | |
| #set -e -o -u | |
| CACHE_FILE="$HOME/.cache/ccstatusline-usage.txt" | |
| LOCK_FILE="$HOME/.cache/ccstatusline-usage.lock" | |
| # Function to generate progress bar | |
| make_bar() { | |
| local pct="$1" | |
| local width=15 | |
| local filled=$((pct * width / 100)) | |
| local empty=$((width - filled)) | |
| printf "[" | |
| for ((i=0; i<filled; i++)); do printf "█"; done | |
| for ((i=0; i<empty; i++)); do printf "░"; done | |
| printf "]" | |
| } | |
| # Use cache if < 180 seconds old | |
| if [[ -f "$CACHE_FILE" ]]; then | |
| AGE=$(($(date +%s) - $(stat -f '%m' "$CACHE_FILE"))) | |
| [[ $AGE -lt 180 ]] && cat "$CACHE_FILE" && exit 0 | |
| fi | |
| # Rate limit: only try API once per 30 seconds | |
| if [[ -f "$LOCK_FILE" ]]; then | |
| LOCK_AGE=$(($(date +%s) - $(stat -f '%m' "$LOCK_FILE"))) | |
| if [[ $LOCK_AGE -lt 30 ]]; then | |
| [[ -f "$CACHE_FILE" ]] && cat "$CACHE_FILE" && exit 0 | |
| echo "[Timeout]" && exit 1 | |
| fi | |
| fi | |
| touch "$LOCK_FILE" | |
| TOKEN=$(security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null | jq -r '.claudeAiOauth.accessToken // empty') | |
| if [[ -z "$TOKEN" ]]; then | |
| [[ -f "$CACHE_FILE" ]] && cat "$CACHE_FILE" && exit 0 | |
| echo "[No credentials]" | |
| exit 1 | |
| fi | |
| RESPONSE=$(curl -s --max-time 5 "https://api.anthropic.com/api/oauth/usage" -H "Authorization: Bearer $TOKEN" -H "anthropic-beta: oauth-2025-04-20" 2>/dev/null) | |
| if [[ -z "$RESPONSE" ]]; then | |
| [[ -f "$CACHE_FILE" ]] && cat "$CACHE_FILE" && exit 0 | |
| echo "[API Error]" | |
| exit 1 | |
| fi | |
| SESSION=$(echo "$RESPONSE" | jq -r '.five_hour.utilization // empty' 2>/dev/null) | |
| WEEKLY=$(echo "$RESPONSE" | jq -r '.seven_day.utilization // empty' 2>/dev/null) | |
| WEEKLY_RESET=$(echo "$RESPONSE" | jq -r '.seven_day.resets_at // empty' 2>/dev/null) | |
| FIVE_HOURS_RESET=$(echo "$RESPONSE" | jq -r '.five_hour.resets_at // empty' 2>/dev/null) | |
| # If API failed, use stale cache or show error | |
| if [[ -z "$SESSION" || -z "$WEEKLY" ]]; then | |
| [[ -f "$CACHE_FILE" ]] && cat "$CACHE_FILE" && exit 0 | |
| echo "[Parse Error]" | |
| exit 1 | |
| fi | |
| SESSION_INT=${SESSION%.*} | |
| WEEKLY_INT=${WEEKLY%.*} | |
| # Convert UTC timestamps to local timezone and format without timezone indicator | |
| WEEKLY_EPOCH=$(TZ=UTC0 date -j -f "%Y-%m-%dT%H:%M:%S" "${WEEKLY_RESET:0:19}" "+%s" 2>/dev/null) | |
| WEEKLY_RESET_TRUNCATED=$(date -r "$WEEKLY_EPOCH" "+%y-%m-%d %H:%M" 2>/dev/null) | |
| FIVE_HOURS_EPOCH=$(TZ=UTC0 date -j -f "%Y-%m-%dT%H:%M:%S" "${FIVE_HOURS_RESET:0:19}" "+%s" 2>/dev/null) | |
| FIVE_HOURS_RESET_TRUNCATED=$(date -r "$FIVE_HOURS_EPOCH" "+%y-%m-%d %H:%M" 2>/dev/null) | |
| SESSION_BAR=$(make_bar "$SESSION_INT") | |
| WEEKLY_BAR=$(make_bar "$WEEKLY_INT") | |
| echo "Session (⌛ $FIVE_HOURS_RESET_TRUNCATED): $SESSION_BAR ${SESSION}% | Weekly (⌛ $WEEKLY_RESET_TRUNCATED): $WEEKLY_BAR ${WEEKLY}%" | tee "$CACHE_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment