16 lines
627 B
Bash
Executable File
16 lines
627 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
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
|