From 04a6c2cd252c0036979cd149f476c0a845da229b Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 5 Jan 2025 23:05:24 +0100 Subject: [PATCH] scripts/tmuxs/new.sh: correctly attach to tmux session when outside of tmux. --- scripts/tmuxs/new.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/tmuxs/new.sh b/scripts/tmuxs/new.sh index 161a127..deef6c8 100755 --- a/scripts/tmuxs/new.sh +++ b/scripts/tmuxs/new.sh @@ -24,5 +24,9 @@ if ! tmux has-session -t=$selected_name 2> /dev/null; then tmux new-session -ds $selected_name -c $selected fi -tmux switch-client -t $selected_name +if [[ -z $TMUX ]]; then + tmux attach -t $selected_name +else : + tmux switch-client -t $selected_name +fi