-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Problem
When using $fill in the starship config to right-align segments (e.g. model/context/cost on the right), starship defaults to 80 columns because the Claude Code statusline subprocess doesn't have a real TTY attached. This means the fill module doesn't push content to the actual right edge.
Workaround
Detect the real terminal width via the parent process's TTY and pass it to starship with -w:
# Detect real terminal width via parent process TTY
term_width=""
parent_tty="$(ps -o tty= -p "$(ps -o ppid= -p $$)" 2>/dev/null | tr -d ' ')"
if [ -n "$parent_tty" ] && [ "$parent_tty" != "??" ] && [ "$parent_tty" != "?" ]; then
w="$(stty size < "/dev/$parent_tty" 2>/dev/null | awk '{print $2}')"
if [ -n "$w" ] && [ "$w" -gt 0 ] 2>/dev/null; then
term_width=$((w - 6))
fi
fiThen pass -w $term_width to starship prompt if set.
This technique is borrowed from ccstatusline which uses the same parent TTY approach.
Example config with fill
format = """
$directory \
$git_branch$git_status\
$fill\
${env_var.CLAUDE_MODEL_NERD} \
${env_var.CLAUDE_CONTEXT} \
${env_var.CLAUDE_COST}\
"""
[fill]
symbol = " "Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels