chpwd.sh
· 447 B · Bash
Raw
# Auto-set wezterm tab title based on directory
chpwd() {
if [[ -d .git ]]; then
# Use git repo name
local repo=$(basename $(git rev-parse --show-toplevel 2>/dev/null))
wezterm cli set-tab-title "$repo" 2>/dev/null
elif [[ $(pwd) =~ "/home/sajenim/.repositories/personal/([^/]+)" ]]; then
# Use directory name for project dirs
wezterm cli set-tab-title "''${match[1]}" 2>/dev/null
fi
}
# Run once on shell startup
chpwd
| 1 | # Auto-set wezterm tab title based on directory |
| 2 | chpwd() { |
| 3 | if [[ -d .git ]]; then |
| 4 | # Use git repo name |
| 5 | local repo=$(basename $(git rev-parse --show-toplevel 2>/dev/null)) |
| 6 | wezterm cli set-tab-title "$repo" 2>/dev/null |
| 7 | elif [[ $(pwd) =~ "/home/sajenim/.repositories/personal/([^/]+)" ]]; then |
| 8 | # Use directory name for project dirs |
| 9 | wezterm cli set-tab-title "''${match[1]}" 2>/dev/null |
| 10 | fi |
| 11 | } |
| 12 | |
| 13 | # Run once on shell startup |
| 14 | chpwd |
| 15 |