e884e4a88f
Bring ~/.claude config under bombadil management across both machines:
- claude/shared/: converged settings.json (union of both hosts) and a single
Catppuccin-powerline statusline merged from the two machines' versions
- claude/xps, claude/desktop: per-host agents/skills behind [profiles.xps]/
[profiles.desktop]; each host links only its own via `bombadil link -p <theme> <host>`
Linked at file granularity because bombadil 4.2.0 can't create directory
symlinks for new targets, and to keep ~/.claude/{agents,skills} real dirs.
Add a Justfile (symlinked to ~/.justfile, usable via `just -g`) with link/
dark/light/watch/unlink/update/status/edit recipes; host auto-detected from
hostname. Recipes use exported shell vars to avoid bombadil's Tera engine
mis-parsing just's double-brace interpolation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
96 lines
3.1 KiB
Bash
96 lines
3.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Claude Code statusLine — Catppuccin Mocha style matching starship.toml
|
|
# Structure: [CAP_L][seg1][WEDGE][seg2][WEDGE]...[segN][CAP_R]
|
|
|
|
input=$(cat)
|
|
|
|
# Catppuccin Mocha palette
|
|
red="#f38ba8"
|
|
peach="#fab387"
|
|
yellow="#f9e2af"
|
|
sapphire="#74c7ec"
|
|
lavender="#b4befe"
|
|
crust="#11111b"
|
|
|
|
RST=$'\033[0m'
|
|
BGDEF=$'\033[49m'
|
|
|
|
r_fg() { printf '\033[38;2;%d;%d;%dm' $((16#${1:1:2})) $((16#${1:3:2})) $((16#${1:5:2})); }
|
|
r_bg() { printf '\033[48;2;%d;%d;%dm' $((16#${1:1:2})) $((16#${1:3:2})) $((16#${1:5:2})); }
|
|
|
|
CAP_L=$'' # U+E0B6 — left rounded open cap
|
|
WEDGE=$'' # U+E0B0 — right-pointing filled arrow (between segments)
|
|
CAP_R=$'' # U+E0B4 — right rounded close cap
|
|
|
|
# Parse JSON input
|
|
cwd=$(printf '%s' "$input" | jq -r '.workspace.current_dir // .cwd // ""')
|
|
model=$(printf '%s' "$input" | jq -r '.model.display_name // .model.id // ""')
|
|
used_pct=$(printf '%s' "$input" | jq -r '.context_window.used_percentage // empty')
|
|
|
|
# Substitute $HOME → ~, then truncate to last 3 path segments (starship truncation_length=3)
|
|
display_cwd="${cwd/#$HOME/\~}"
|
|
truncated_cwd=$(printf '%s' "$display_cwd" | awk -F'/' '{
|
|
n=NF
|
|
if (n <= 3) { print $0 }
|
|
else { printf "…/%s/%s/%s", $(n-2), $(n-1), $n }
|
|
}')
|
|
|
|
# Git ref: prefer the worktree name, then the live branch, then a short SHA
|
|
git_branch=$(printf '%s' "$input" | jq -r '.worktree.name // .workspace.git_worktree // empty')
|
|
if [ -z "$git_branch" ]; then
|
|
git_branch=$(GIT_OPTIONAL_LOCKS=0 git -C "$cwd" symbolic-ref --short HEAD 2>/dev/null \
|
|
|| GIT_OPTIONAL_LOCKS=0 git -C "$cwd" rev-parse --short HEAD 2>/dev/null \
|
|
|| echo "")
|
|
fi
|
|
|
|
# Build segment list: parallel arrays of (color, icon, text)
|
|
declare -a colors=()
|
|
declare -a icons=()
|
|
declare -a texts=()
|
|
|
|
colors+=("$red"); icons+=($''); texts+=("$(whoami)") # Manjaro
|
|
colors+=("$peach"); icons+=($''); texts+=("$truncated_cwd") # folder
|
|
if [ -n "$git_branch" ]; then
|
|
colors+=("$yellow"); icons+=($''); texts+=("$git_branch") # git branch
|
|
fi
|
|
colors+=("$sapphire"); icons+=($''); texts+=("$model") # sparkle ✦
|
|
if [ -n "$used_pct" ]; then
|
|
ctx_display=$(printf "%.0f" "$used_pct")
|
|
if [ "$ctx_display" -ge 80 ]; then ctx_color="$red"; else ctx_color="$lavender"; fi
|
|
colors+=("$ctx_color"); icons+=($''); texts+=("${ctx_display}%") # clock
|
|
fi
|
|
|
|
# segment count via positional params — the brace-hash array-length form trips
|
|
# bombadil's Tera renderer, which treats brace-hash as a comment opener
|
|
set -- "${colors[@]}"; n=$#
|
|
|
|
for i in $(seq 0 $((n-1))); do
|
|
color="${colors[$i]}"
|
|
icon="${icons[$i]}"
|
|
text="${texts[$i]}"
|
|
|
|
if [ "$i" -eq 0 ]; then
|
|
# Very first segment: print left rounded opening cap
|
|
printf '%b' "$RST"
|
|
r_fg "$color"
|
|
printf '%s' "$CAP_L"
|
|
else
|
|
# Transition from previous segment: wedge (fg=prev color, bg=this color)
|
|
prev="${colors[$((i-1))]}"
|
|
r_bg "$color"
|
|
r_fg "$prev"
|
|
printf '%s' "$WEDGE"
|
|
fi
|
|
|
|
# Segment body
|
|
r_bg "$color"
|
|
r_fg "$crust"
|
|
printf ' %s %s ' "$icon" "$text"
|
|
done
|
|
|
|
# Right rounded closing cap after last segment
|
|
printf '%b' "$BGDEF"
|
|
r_fg "${colors[$((n-1))]}"
|
|
printf '%s' "$CAP_R"
|
|
printf '%b' "$RST"
|