Skip to content

Instantly share code, notes, and snippets.

@rvanbaalen
Last active January 28, 2026 13:08
Show Gist options
  • Select an option

  • Save rvanbaalen/6f4f16140f8aa56c85b85cd5a47d8bfe to your computer and use it in GitHub Desktop.

Select an option

Save rvanbaalen/6f4f16140f8aa56c85b85cd5a47d8bfe to your computer and use it in GitHub Desktop.
Claude Code custom statusline installer - shows model, working directory, and git branch with colors

Claude Code Custom Statusline

Adds a custom statusline to Claude Code showing:

  • Model name (cyan)
  • Working directory (yellow)
  • Git branch (green)

Example output: [Opus] my-project (develop)

image

Install

curl -fsSL https://gist.githubusercontent.com/rvanbaalen/6f4f16140f8aa56c85b85cd5a47d8bfe/raw/install-claude-statusline.sh | bash

Uninstall

curl -fsSL https://gist.githubusercontent.com/rvanbaalen/6f4f16140f8aa56c85b85cd5a47d8bfe/raw/install-claude-statusline.sh | bash -s -- --uninstall

Requirements

  • Claude Code
  • jq (the installer will offer to install it via Homebrew if missing)
#!/bin/bash
# Handle --uninstall flag
if [ "$1" == "--uninstall" ]; then
echo "Claude Code Statusline Uninstaller"
echo "==================================="
echo ""
if [ -f ~/.claude/statusline.sh ]; then
rm ~/.claude/statusline.sh
echo "Removed ~/.claude/statusline.sh"
fi
if [ -f ~/.claude/settings.json ] && command -v jq &> /dev/null; then
jq 'del(.statusLine)' ~/.claude/settings.json > ~/.claude/settings.tmp && mv ~/.claude/settings.tmp ~/.claude/settings.json
echo "Removed statusLine config from settings.json"
elif [ -f ~/.claude/settings.json ]; then
echo "Warning: jq not installed, cannot update settings.json automatically."
echo "Please manually remove the 'statusLine' section from ~/.claude/settings.json"
fi
echo ""
echo "Done! Restart Claude Code to apply changes."
exit 0
fi
echo "Claude Code Statusline Installer"
echo "================================="
echo ""
# Check for jq
if ! command -v jq &> /dev/null; then
echo "jq is required but not installed."
echo ""
# Check for Homebrew
if command -v brew &> /dev/null; then
read -p "Would you like to install jq via Homebrew? (y/n) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Installing jq..."
brew install jq
if [ $? -ne 0 ]; then
echo "Failed to install jq. Please install it manually and try again."
exit 1
fi
else
echo "Please install jq and run this script again."
exit 1
fi
else
echo "Please install jq first:"
echo " - macOS (Homebrew): brew install jq"
echo " - macOS (MacPorts): sudo port install jq"
echo " - Ubuntu/Debian: sudo apt-get install jq"
echo " - Fedora: sudo dnf install jq"
echo " - Windows: choco install jq"
echo ""
echo "Then run this script again."
exit 1
fi
fi
echo "Creating ~/.claude directory..."
mkdir -p ~/.claude
echo "Installing statusline script..."
cat > ~/.claude/statusline.sh << 'EOF'
#!/bin/bash
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name')
CURRENT_DIR=$(echo "$input" | jq -r '.workspace.current_dir')
CYAN='\033[36m'
YELLOW='\033[33m'
GREEN='\033[32m'
RESET='\033[0m'
GIT_BRANCH=""
if git rev-parse --git-dir > /dev/null 2>&1; then
BRANCH=$(git branch --show-current 2>/dev/null)
[ -n "$BRANCH" ] && GIT_BRANCH=" ${GREEN}($BRANCH)${RESET}"
fi
echo -e "${CYAN}[$MODEL]${RESET} ${YELLOW}${CURRENT_DIR##*/}${RESET}$GIT_BRANCH"
EOF
chmod +x ~/.claude/statusline.sh
echo "Updating settings.json..."
STATUSLINE_CONFIG='{"statusLine":{"type":"command","command":"~/.claude/statusline.sh","padding":0}}'
if [ -f ~/.claude/settings.json ]; then
jq ". + $STATUSLINE_CONFIG" ~/.claude/settings.json > ~/.claude/settings.tmp && mv ~/.claude/settings.tmp ~/.claude/settings.json
else
echo "$STATUSLINE_CONFIG" | jq '.' > ~/.claude/settings.json
fi
echo ""
echo "Done! Restart Claude Code to see your new statusline."
echo "It will display: [Model] directory-name (git-branch)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment