Created
February 21, 2026 01:09
-
-
Save ivangarzab/d8977c21f8cd380d59bfc066794a16ea to your computer and use it in GitHub Desktop.
Claude Code statusline
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 | |
| # Add the following block at the bottom of: ~/.claude/settings.json | |
| # | |
| # "statusLine": { | |
| # "type": "command", | |
| # "command": "bash /Users/ivangarza/.claude/statusline-command.sh" | |
| # } | |
| # | |
| # statusline format: | |
| # {matrix_green}◀ <repo>[<branch>](<git_status>) ▶ {dark_gray}[<model>] [Context: <percentage>%] | |
| # Read JSON input from stdin | |
| input=$(cat) | |
| # Extract values from JSON | |
| cwd=$(echo "$input" | jq -r '.workspace.current_dir') | |
| session_name=$(echo "$input" | jq -r '.session_name // empty') | |
| model_name=$(echo "$input" | jq -r '.model.display_name') | |
| used_pct=$(echo "$input" | jq -r '.context_window.used_percentage // empty') | |
| # Generate Starship prompt | |
| # Set PWD for Starship to use the correct directory | |
| export PWD="$cwd" | |
| cd "$cwd" 2>/dev/null || true | |
| starship_output=$(starship prompt --status=0 --jobs=0 2>/dev/null | tr -d '\n' | sed 's/%{[^}]*}//g') | |
| # Matrix green color (ANSI color code 32 for bright green) | |
| matrix_green=$'\033[32m' | |
| reset=$'\033[0m' | |
| # Build context info | |
| context_info="" | |
| if [ -n "$session_name" ]; then | |
| context_info="[$session_name]" | |
| fi | |
| if [ -n "$model_name" ]; then | |
| if [ -n "$context_info" ]; then | |
| context_info="${context_info} [${model_name}]" | |
| else | |
| context_info="[${model_name}]" | |
| fi | |
| fi | |
| if [ -n "$used_pct" ]; then | |
| # Round to whole number | |
| used_rounded=$(printf "%.0f" "$used_pct") | |
| if [ -n "$context_info" ]; then | |
| context_info="${context_info} [Context: ${used_rounded}%]" | |
| else | |
| context_info="[Context: ${used_rounded}%]" | |
| fi | |
| fi | |
| # Output: Starship prompt in Matrix green + context info | |
| if [ -n "$context_info" ]; then | |
| echo -e "${matrix_green}${starship_output}${reset} ${context_info}" | |
| else | |
| echo -e "${matrix_green}${starship_output}${reset}" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment