From 98d30864179b6329dd4bf105507bfa332c1fe903 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Mon, 13 Nov 2023 09:41:46 +0100 Subject: [PATCH] fix(tmux): Projects are now opening correctly with either argument --- .bin/tmux-projectinator | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.bin/tmux-projectinator b/.bin/tmux-projectinator index f6f7dfb..33b32e4 100755 --- a/.bin/tmux-projectinator +++ b/.bin/tmux-projectinator @@ -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