Last active 1 month ago

chpwd.sh Raw
1# Auto-set wezterm tab title based on directory
2chpwd() {
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
14chpwd
15