feat(tmux): inline tab-name format, remove script
Replace external tab-name.sh with a tmux format string that shows pane_current_path for shell processes and pane_current_command otherwise, truncated to 15 chars. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tab name for tmux automatic-rename.
|
||||
# Usage: tab-name.sh <command> <dirname>
|
||||
# Shows dirname for shells, command for everything else. Truncates at 15 with ….
|
||||
|
||||
cmd="$1"
|
||||
dir="$2"
|
||||
max=15
|
||||
|
||||
case "$cmd" in
|
||||
zsh|bash|fish|sh) name="$dir" ;;
|
||||
*) name="$cmd" ;;
|
||||
esac
|
||||
|
||||
# In Codespaces, show friendly name without trailing random ID
|
||||
# Codespace names: "adjective-noun-id" where id is alphanumeric gibberish
|
||||
if [[ -n "$CODESPACE_NAME" ]]; then
|
||||
friendly="${CODESPACE_NAME%-*}"
|
||||
# If no hyphen was found, use full name
|
||||
[[ "$friendly" == "$CODESPACE_NAME" ]] && friendly="$CODESPACE_NAME"
|
||||
echo "cs:${friendly}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if (( ${#name} > max )); then
|
||||
echo "${name:0:$max}…"
|
||||
else
|
||||
echo "$name"
|
||||
fi
|
||||
Reference in New Issue
Block a user