From 8b2546a554a4e0c05da67d06054814eec3f71ddb Mon Sep 17 00:00:00 2001 From: Andrejus Date: Fri, 13 Mar 2026 17:17:37 +0000 Subject: [PATCH] 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> --- home/.tmux.conf | 2 +- home/.tmux/tab-name.sh | 29 ----------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) delete mode 100755 home/.tmux/tab-name.sh diff --git a/home/.tmux.conf b/home/.tmux.conf index 7724782..5d17623 100644 --- a/home/.tmux.conf +++ b/home/.tmux.conf @@ -94,4 +94,4 @@ set -g lock-after-time 180 set -g lock-command 'eval $(grep active_total ${TMPDIR:-/tmp}/.tmux_heartbeat 2>/dev/null); ~/.tmux/donut ${active_total:-0}' set -g automatic-rename on set -g allow-rename off -set -g automatic-rename-format '#(~/.tmux/tab-name.sh "#{pane_current_command}" "#{b:pane_current_path}")' +set -g automatic-rename-format '#{=/15/…:#{?#{||:#{m:zsh,#{pane_current_command}},#{||:#{m:bash,#{pane_current_command}},#{||:#{m:fish,#{pane_current_command}},#{m:sh,#{pane_current_command}}}}},#{b:pane_current_path},#{pane_current_command}}}' diff --git a/home/.tmux/tab-name.sh b/home/.tmux/tab-name.sh deleted file mode 100755 index 593d6a2..0000000 --- a/home/.tmux/tab-name.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# Tab name for tmux automatic-rename. -# Usage: tab-name.sh -# 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