Improve git worktree session workflow

This commit is contained in:
2026-08-10 12:42:53 +01:00
parent c97c9cb027
commit 56b5bdb5ac
6 changed files with 67 additions and 4 deletions

View File

@@ -2,8 +2,14 @@
session_name=$(tmux display-message -p '#S')
session_layout=~/.local/share/tmux/layouts/session-$session_name
# Set by `session -p <project>`, which names the session after the project but
# can't be relied on for the lookup above since tmux rewrites `.` in names.
session_project=$(tmux show-environment -t "$session_name" TMUX_PROJECT 2>/dev/null |
sed -n 's/^TMUX_PROJECT=//p')
if [ -f $session_layout ]; then
$session_layout
elif [ -n "$session_project" ]; then
~/.local/share/tmux/layouts/session-project "$session_project"
elif [ "$session_name" != "agent" ]; then
tmux rename-window home
fi