Last active 1 month ago

sajenim's Avatar sajenim revised this gist 1 month ago. Go to revision

1 file changed, 14 insertions

chpwd.sh(file created)

@@ -0,0 +1,14 @@
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
Newer Older