Fix tmux-session-init bug, more exact match for existing session names

This commit is contained in:
2026-01-14 14:00:01 -06:00
parent 7b2559561e
commit 9f67636472

View File

@@ -31,11 +31,7 @@ fi
[[ -z $tmux_target_name ]] && exit 0 [[ -z $tmux_target_name ]] && exit 0
# TODO: bug in the check below, matches even when target name is a subset of an existing ! (echo $tmux_existing_sessions | grep -q "^$tmux_target_name:") &&
# session's name, so a new session is not created in that case even though
# example: existing session with name 'dwm-suckless' will match at be opened even
# when attempting to open a new session with a target name of only 'dwm'
! (echo $tmux_existing_sessions | grep -q "$tmux_target_name") &&
tmux new-session -d -s $tmux_target_name -c $tmux_target_path && tmux new-session -d -s $tmux_target_name -c $tmux_target_path &&
tmux_hydrate $tmux_target_name $tmux_target_path tmux_hydrate $tmux_target_name $tmux_target_path
tmux_switch_to $tmux_target_name tmux_switch_to $tmux_target_name