|
14 | 14 | # will generally not involve changes to this script. |
15 | 15 | # |
16 | 16 | # Claude Code Status Line - Display usage information |
17 | | -# Format: <model> [<cwd>] <branch> | $X.XX @ Xh:Ym:Zs | lines: +X, -X | Session: <name> | Fast: <On/Off> | RLCR: <status> |
| 17 | +# Format: <model> | [context bar] | $X.XX @ Xh:Ym:Zs |
18 | 18 |
|
19 | 19 | input=$(cat) |
20 | 20 |
|
@@ -104,7 +104,7 @@ get_rlcr_status() { |
104 | 104 | fi |
105 | 105 | [[ -z "$any_state" ]] && continue |
106 | 106 | local stored_sid |
107 | | - stored_sid=$(sed -n '/^---$/,/^---$/{ /^session_id:/{ s/session_id: *//; p; } }' "$any_state" 2>/dev/null | tr -d ' ') |
| 107 | + stored_sid=$(awk '/^---$/{n++; next} n==1 && /^session_id:/{sub(/^session_id: */, ""); gsub(/ /, ""); print; exit}' "$any_state" 2>/dev/null) |
108 | 108 | if [[ -n "$stored_sid" ]]; then |
109 | 109 | _resolve_rlcr_display "$trimmed" |
110 | 110 | return |
@@ -133,7 +133,7 @@ get_rlcr_status() { |
133 | 133 |
|
134 | 134 | # Extract stored session_id from YAML frontmatter |
135 | 135 | local stored_sid |
136 | | - stored_sid=$(sed -n '/^---$/,/^---$/{ /^session_id:/{ s/session_id: *//; p; } }' "$any_state" 2>/dev/null | tr -d ' ') |
| 136 | + stored_sid=$(awk '/^---$/{n++; next} n==1 && /^session_id:/{sub(/^session_id: */, ""); gsub(/ /, ""); print; exit}' "$any_state" 2>/dev/null) |
137 | 137 |
|
138 | 138 | # Skip session-unaware entries when session-aware ones exist |
139 | 139 | if [[ -z "$stored_sid" ]]; then |
@@ -328,28 +328,18 @@ BLUE="\e[34m" # Label - for Session |
328 | 328 | MAGENTA="\e[35m" # Label - for RLCR and Fast |
329 | 329 | RESET="\e[0m" |
330 | 330 |
|
331 | | -# Auto-rename tmux window to session customTitle if inside tmux |
332 | | -if [[ -n "$TMUX" && -n "$SESSION_DISPLAY" ]]; then |
333 | | - # UUID pattern: 8-4-4-4-12 hex chars |
334 | | - if [[ ! "$SESSION_DISPLAY" =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ ]]; then |
335 | | - tmux rename-window "$SESSION_DISPLAY" 2>/dev/null |
336 | | - fi |
337 | | -fi |
338 | | - |
339 | 331 | # Shorten CWD: replace $HOME with ~ |
340 | 332 | TILDE='~' |
341 | 333 | CWD_SHORT="${CWD/#$HOME/$TILDE}" |
342 | 334 |
|
343 | | -# Line 1: model | cost @ duration |
344 | | -printf "%b%s%b | %b\$%s%b @ %s\n" \ |
| 335 | +# Line 1: model | context bar | cost @ duration |
| 336 | +printf "%b%s%b | %b | %b\$%s%b @ %s\n" \ |
345 | 337 | "$CORAL" "${MODEL:-?}" "$RESET" \ |
| 338 | + "$CONTEXT_BAR" \ |
346 | 339 | "$GREEN" "$COST_STR" "$RESET" \ |
347 | 340 | "$DURATION_STR" |
348 | 341 |
|
349 | | -# Line 2: context bar |
350 | | -printf "%b\n" "$CONTEXT_BAR" |
351 | | - |
352 | | -# Line 3: cwd [branch] | lines |
| 342 | +# Line 2: cwd [branch] | lines |
353 | 343 | printf "%b%s%b [%b%s%b] | lines: %b+%s%b, %b-%s%b\n" \ |
354 | 344 | "$CYAN" "${CWD_SHORT:-?}" "$RESET" \ |
355 | 345 | "$YELLOW" "$BRANCH" "$RESET" \ |
|
0 commit comments