From ac64bb150562dec7b16b98028f66bd98c4474e43 Mon Sep 17 00:00:00 2001 From: vitaly Date: Sat, 6 Jun 2026 13:13:34 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D1=80=D0=B0=D1=81=D0=BA=D1=80=D0=B0?= =?UTF-8?q?=D1=81=D0=B8=D1=82=D1=8C=20ctx=20=D0=BF=D0=BE=20=D1=83=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=BD=D1=8F=D0=BC=20=D0=B8=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=B7=D0=B2=D1=83=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=BE=D0=B9=20=D1=81=D0=B8=D0=B3=D0=BD=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=2060%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - зелёный <30%, жёлтый 30-50%, красный 50%+ - однократный звуковой сигнал (alarm-clock-elapsed.oga, 1s) при первом достижении 60% - сброс флага алерта когда ctx опускается ниже 50% Co-Authored-By: Claude Sonnet 4.6 --- home-configs/claude/statusline-command.sh | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/home-configs/claude/statusline-command.sh b/home-configs/claude/statusline-command.sh index a4c3502..7ee2422 100644 --- a/home-configs/claude/statusline-command.sh +++ b/home-configs/claude/statusline-command.sh @@ -52,5 +52,29 @@ else fi fi -[ -n "$ctx_pct" ] && printf " \033[00;90mctx:$(printf '%.0f' "$ctx_pct")%%\033[00m" +if [ -n "$ctx_pct" ]; then + ctx_int=$(printf '%.0f' "$ctx_pct") + if [ "$ctx_int" -lt 30 ]; then + ctx_color="\033[00;32m" + elif [ "$ctx_int" -lt 50 ]; then + ctx_color="\033[00;33m" + else + ctx_color="\033[00;31m" + fi + printf " ${ctx_color}ctx:${ctx_int}%%\033[00m" + + # Звуковой сигнал при первом достижении 60% + alert_file="$HOME/.cache/ai-setup/ctx_alert_state" + if [ "$ctx_int" -ge 60 ]; then + if [ ! -f "$alert_file" ] || [ "$(cat "$alert_file")" != "alerted" ]; then + mkdir -p "$HOME/.cache/ai-setup" + echo "alerted" > "$alert_file" + (timeout 1s paplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga 2>/dev/null || \ + paplay /usr/share/sounds/freedesktop/stereo/dialog-warning.oga 2>/dev/null || \ + printf '\a') & + fi + elif [ "$ctx_int" -lt 50 ]; then + rm -f "$alert_file" 2>/dev/null + fi +fi exit 0