From 0b0d51b77c1090b7e50c2dcd4775f1f5ccbc296c Mon Sep 17 00:00:00 2001 From: vitaly Date: Sun, 7 Jun 2026 00:28:49 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=86=D0=B2=D0=B5=D1=82=D0=B0=20=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=82=D1=83=D1=81=D0=BD=D0=BE=D0=B9=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - путь и ветка: светло-серый (37), как хинты Claude Code - модель: приглушённый лососевый (173), фирменный цвет Claude - лимиты и ctx: единая функция pct_color (зелёный/жёлтый/красный) Co-Authored-By: Claude Sonnet 4.6 --- home-configs/claude/statusline-command.sh | 36 +++++++++++++++-------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/home-configs/claude/statusline-command.sh b/home-configs/claude/statusline-command.sh index aaefb98..ad1b1d9 100644 --- a/home-configs/claude/statusline-command.sh +++ b/home-configs/claude/statusline-command.sh @@ -11,10 +11,10 @@ ctx_pct=$(echo "$input" | jq -r '.context_window.used_percentage // empty') branch=$(git -C "$cwd" --no-optional-locks symbolic-ref --short HEAD 2>/dev/null) short_cwd="${cwd/#$HOME/\~}" -printf "\033[01;34m%s\033[00m" "$short_cwd" +printf "\033[00;37m%s\033[00m" "$short_cwd" -[ -n "$branch" ] && printf " \033[01;33m[%s]\033[00m" "$branch" -[ -n "$model" ] && printf " \033[00;36m%s\033[00m" "$model" +[ -n "$branch" ] && printf " \033[00;37m[%s]\033[00m" "$branch" +[ -n "$model" ] && printf " \033[38;5;173m%s\033[00m" "$model" # Форматирует оставшееся время до сброса лимита fmt_remaining() { @@ -35,6 +35,18 @@ fmt_remaining() { fi } +# Возвращает ANSI-цвет по проценту: зелёный <40%, жёлтый 40-60%, красный >=60% +pct_color() { + local pct="$1" + if [ "$pct" -lt 40 ]; then + printf '\033[00;32m' + elif [ "$pct" -lt 60 ]; then + printf '\033[00;33m' + else + printf '\033[00;31m' + fi +} + if [[ "$model" == *[Dd]eep[Ss]eek* ]]; then cache_file="$HOME/.cache/ai-setup/deepseek_balance" if [ -f "$cache_file" ]; then @@ -43,25 +55,23 @@ if [[ "$model" == *[Dd]eep[Ss]eek* ]]; then fi else if [ -n "$five_pct" ] && [ -n "$five_reset" ]; then + five_int=$(printf '%.0f' "$five_pct") remaining=$(fmt_remaining "$five_reset") - printf " \033[00;35m%s:$(printf '%.0f' "$five_pct")%%\033[00m" "$remaining" + color=$(pct_color "$five_int") + printf " %s%s:%s%%\033[00m" "$color" "$remaining" "$five_int" fi if [ -n "$week_pct" ] && [ -n "$week_reset" ]; then + week_int=$(printf '%.0f' "$week_pct") remaining=$(fmt_remaining "$week_reset") - printf " \033[00;35m%s:$(printf '%.0f' "$week_pct")%%\033[00m" "$remaining" + color=$(pct_color "$week_int") + printf " %s%s:%s%%\033[00m" "$color" "$remaining" "$week_int" fi fi if [ -n "$ctx_pct" ]; then ctx_int=$(printf '%.0f' "$ctx_pct") - if [ "$ctx_int" -lt 40 ]; then - ctx_color="\033[00;32m" - elif [ "$ctx_int" -lt 60 ]; then - ctx_color="\033[00;33m" - else - ctx_color="\033[00;31m" - fi - printf " ${ctx_color}ctx:${ctx_int}%%\033[00m" + color=$(pct_color "$ctx_int") + printf " %sctx:%s%%\033[00m" "$color" "$ctx_int" # Звуковой сигнал при первом достижении 60% alert_file="$HOME/.cache/ai-setup/ctx_alert_state"