fix(tmux): Projects are now opening correctly with either argument

This commit is contained in:
Tanguy Herbron 2023-11-13 09:41:46 +01:00
parent 64dd619da8
commit 98d3086417

View File

@ -7,12 +7,12 @@ bind '"\e": "\C-W\c-d"'
move_pane () {
tmux has-session -t $SESSION_NAME 2>/dev/null
if [ $? != 0 ]; then
tmux new-session -s $SESSION_NAME -d -n $PROJECT #2>/dev/null
tmux new-session -s $SESSION_NAME -d -n $PROJECT -c $1
fi
tmux has-session -t $SESSION_NAME:$PROJECT 2>/dev/null
if [ $? != 0 ]; then
tmux new-window -t $SESSION_NAME: -n $PROJECT -d -c $SELECTED
tmux new-window -t $SESSION_NAME: -n $PROJECT -d -c $1
fi
tmux switch-client -t $SESSION_NAME:$PROJECT
@ -33,15 +33,12 @@ SESSION_NAME=$([ -z "${CUSTOM_SESSIONS[$ROOT]}" ] && echo "$ROOT" || echo "${CUS
while getopts ":l" option; do
case $option in
l)
tmux send-keys 'cd $SELECTED' Enter
tmux send-keys "cd $SELECTED" Enter
# Close tmux popup if any
tmux display-popup -C
;;
*)
move_pane
;;
esac
done
if [ $OPTIND -eq 1 ]; then move_pane "$SELECTED"; fi