diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-01-17 12:12:19 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-01-17 12:12:19 +0900 |
| commit | 501af21980ce428a17fd9b382246e344a47a6334 (patch) | |
| tree | 60979bbc460f70da6f6d3385983c6ea347439e91 /ar/.config | |
| parent | 59f2f8eec787ba62971968f7ffab20cb39af7346 (diff) | |
modified claude/settings.json, deleted claude/statusline.sh, created statuslines/
Diffstat (limited to 'ar/.config')
| -rw-r--r-- | ar/.config/claude/settings.json | 9 | ||||
| -rwxr-xr-x | ar/.config/claude/statuslines/statusline.sh (renamed from ar/.config/claude/statusline.sh) | 101 |
2 files changed, 61 insertions, 49 deletions
diff --git a/ar/.config/claude/settings.json b/ar/.config/claude/settings.json index 8c88f47..b1df728 100644 --- a/ar/.config/claude/settings.json +++ b/ar/.config/claude/settings.json @@ -1,5 +1,4 @@ { - "model": "sonnet", "permissions": { "deny": [ "Bash(rm -rf:*)", @@ -11,10 +10,6 @@ "Write(**/.password-store/**/*)" ] }, - "statusLine": { - "type": "command", - "command": "$CLAUDE_CONFIG_DIR/statuslines/statusline.sh" - }, "hooks": { "Notification": [ { @@ -38,5 +33,9 @@ ] } ] + }, + "statusLine": { + "type": "command", + "command": "$CLAUDE_CONFIG_DIR/statuslines/statusline.sh" } } diff --git a/ar/.config/claude/statusline.sh b/ar/.config/claude/statuslines/statusline.sh index 0d524d2..047590a 100755 --- a/ar/.config/claude/statusline.sh +++ b/ar/.config/claude/statuslines/statusline.sh @@ -37,7 +37,7 @@ readonly DIR_ICON="๐" readonly GIT_ICON="๐ฟ" readonly COST_ICON="๐ฐ" readonly TOKEN_ICON="๐" -readonly TIME_ICON="โฑ๏ธ" +readonly TIME_ICON="๐" readonly VERSION_ICON="๐" # Git state constants @@ -120,7 +120,7 @@ readonly LOG_FILE="${SCRIPT_DIR}/statusline.log" log_debug() { local timestamp timestamp=$(date '+%Y-%m-%d %H:%M:%S') - echo "[$timestamp] $*" >> "$LOG_FILE" 2>/dev/null || true + echo "[$timestamp] $*" >>"$LOG_FILE" 2>/dev/null || true } # ============================================================ @@ -139,7 +139,10 @@ sep() { echo -n " ${SEPARATOR} "; } # Format numbers with K/M suffixes format_number() { local num="${1:-0}" - [[ ! "$num" =~ ^[0-9]+$ ]] && { echo "$num"; return; } + [[ ! "$num" =~ ^[0-9]+$ ]] && { + echo "$num" + return + } if [[ "$num" -lt 1000 ]]; then echo "$num" @@ -167,7 +170,10 @@ format_number() { # Format duration (ms to human readable) format_duration() { local ms="${1:-0}" - [[ ! "$ms" =~ ^[0-9]+$ ]] && { echo ""; return; } + [[ ! "$ms" =~ ^[0-9]+$ ]] && { + echo "" + return + } local seconds=$((ms / 1000)) local minutes=$((seconds / 60)) @@ -314,18 +320,18 @@ get_git_info() { local branch="" ahead="0" behind="0" while IFS= read -r line; do case "$line" in - "# branch.head "*) - branch="${line#\# branch.head }" - ;; - "# branch.ab "*) - local ab="${line#\# branch.ab }" - ahead="${ab%% *}" - ahead="${ahead#+}" - behind="${ab##* }" - behind="${behind#-}" - ;; + "# branch.head "*) + branch="${line#\# branch.head }" + ;; + "# branch.ab "*) + local ab="${line#\# branch.ab }" + ahead="${ab%% *}" + ahead="${ahead#+}" + behind="${ab##* }" + behind="${behind#-}" + ;; esac - done <<< "$status_output" + done <<<"$status_output" branch="${branch:-(detached)}" ahead="${ahead:-0}" @@ -335,7 +341,7 @@ get_git_info() { local file_count=0 while IFS= read -r line; do [[ "$line" != \#* && -n "$line" ]] && ((file_count++)) - done <<< "$status_output" + done <<<"$status_output" if [[ "$file_count" -eq 0 ]]; then echo "$STATE_CLEAN|$branch|$ahead|$behind" @@ -350,7 +356,7 @@ get_git_info() { while IFS=$'\t' read -r a r _; do [[ "$a" =~ ^[0-9]+$ ]] && added=$((added + a)) [[ "$r" =~ ^[0-9]+$ ]] && removed=$((removed + r)) - done <<< "$diff_output" + done <<<"$diff_output" fi echo "$STATE_DIRTY|$branch|$file_count|$added|$removed|$ahead|$behind" @@ -392,9 +398,10 @@ build_context_component() { local filled=$((context_percent * BAR_WIDTH / 100)) local empty=$((BAR_WIDTH - filled)) local bar="${bar_color}" - bar+=$(printf "%${filled}s" | tr ' ' "$BAR_FILLED") + local i + for ((i = 0; i < filled; i++)); do bar+="$BAR_FILLED"; done bar+="${GRAY}" - bar+=$(printf "%${empty}s" | tr ' ' "$BAR_EMPTY") + for ((i = 0; i < empty; i++)); do bar+="$BAR_EMPTY"; done bar+="${NC}" # Format numbers @@ -428,30 +435,30 @@ build_git_component() { local git_data="$1" local state - IFS='|' read -r state _ <<< "$git_data" + IFS='|' read -r state _ <<<"$git_data" case "$state" in - "$STATE_NOT_REPO") - return 0 - ;; - "$STATE_CLEAN") - local branch ahead behind - IFS='|' read -r _ branch ahead behind <<< "$git_data" - echo -n "${GIT_ICON} ${MAGENTA}${branch}${NC}" - [[ "$ahead" -gt 0 ]] 2>/dev/null && echo -n " ${GREEN}โ${ahead}${NC}" - [[ "$behind" -gt 0 ]] 2>/dev/null && echo -n " ${RED}โ${behind}${NC}" - ;; - "$STATE_DIRTY") - local branch files added removed ahead behind - IFS='|' read -r _ branch files added removed ahead behind <<< "$git_data" - echo -n "${GIT_ICON} ${MAGENTA}${branch}${NC}" - [[ "$ahead" -gt 0 ]] 2>/dev/null && echo -n " ${GREEN}โ${ahead}${NC}" - [[ "$behind" -gt 0 ]] 2>/dev/null && echo -n " ${RED}โ${behind}${NC}" - echo -n " ${GRAY}ยท${NC} ${ORANGE}${files} files${NC}" - if [[ "$added" -gt 0 || "$removed" -gt 0 ]] 2>/dev/null; then - echo -n " ${GREEN}+${added}${NC}/${RED}-${removed}${NC}" - fi - ;; + "$STATE_NOT_REPO") + return 0 + ;; + "$STATE_CLEAN") + local branch ahead behind + IFS='|' read -r _ branch ahead behind <<<"$git_data" + echo -n "${GIT_ICON} ${MAGENTA}${branch}${NC}" + [[ "$ahead" -gt 0 ]] 2>/dev/null && echo -n " ${GREEN}โ${ahead}${NC}" + [[ "$behind" -gt 0 ]] 2>/dev/null && echo -n " ${RED}โ${behind}${NC}" + ;; + "$STATE_DIRTY") + local branch files added removed ahead behind + IFS='|' read -r _ branch files added removed ahead behind <<<"$git_data" + echo -n "${GIT_ICON} ${MAGENTA}${branch}${NC}" + [[ "$ahead" -gt 0 ]] 2>/dev/null && echo -n " ${GREEN}โ${ahead}${NC}" + [[ "$behind" -gt 0 ]] 2>/dev/null && echo -n " ${RED}โ${behind}${NC}" + echo -n " ${GRAY}ยท${NC} ${ORANGE}${files} files${NC}" + if [[ "$added" -gt 0 || "$removed" -gt 0 ]] 2>/dev/null; then + echo -n " ${GREEN}+${added}${NC}/${RED}-${removed}${NC}" + fi + ;; esac } @@ -553,7 +560,7 @@ main() { read -r duration_ms read -r version read -r session_id - } <<< "$parsed" + } <<<"$parsed" log_debug "Parsed: model=$model_name, dir=$current_dir, context=$current_usage/$context_size, cost=$cost_usd, duration=$duration_ms" @@ -571,11 +578,17 @@ main() { local git_component git_component=$(build_git_component "$git_data") - [[ -n "$git_component" ]] && { output+=$(sep); output+="$git_component"; } + [[ -n "$git_component" ]] && { + output+=$(sep) + output+="$git_component" + } local version_component version_component=$(build_version_component "$version") - [[ -n "$version_component" ]] && { output+=$(sep); output+="$version_component"; } + [[ -n "$version_component" ]] && { + output+=$(sep) + output+="$version_component" + } # Line 2: Context output+=$'\n' |
