diff --git a/scripts/set-topic.sh b/scripts/set-topic.sh index 5ad4c1e..cacc150 100755 --- a/scripts/set-topic.sh +++ b/scripts/set-topic.sh @@ -11,6 +11,16 @@ TOPIC="$*" HASH=$(echo -n "$CWD" | md5sum | cut -d' ' -f1) SESSION_FILE="/tmp/claude-session-id-$HASH" +# If running inside tmux, mirror the topic into the tmux status bar: +# session name = project part (before ':'), @claude_topic = full topic. +if [[ -n "${TMUX:-}" ]]; then + PROJECT="${TOPIC%%:*}" + # tmux session names may not contain ':' or '.' + PROJECT=$(echo "$PROJECT" | tr ':.' '--' | cut -c1-30) + tmux rename-session "$PROJECT" 2>/dev/null || true + tmux set -q @claude_topic "$TOPIC" 2>/dev/null || true +fi + if [[ ! -f "$SESSION_FILE" ]]; then # Session ID file doesn't exist yet — the statusline hook hasn't run. # Write the topic to a pending file so statusline.sh can pick it up