diff --git a/.bin/tmux-projectinator b/.bin/tmux-projectinator index 3154999..2b2ae36 100755 --- a/.bin/tmux-projectinator +++ b/.bin/tmux-projectinator @@ -7,6 +7,13 @@ bind '"\e": "\C-W\c-d"' OPEN_MODE="new_pane" CACHE_FILE=~/.cache/project_list +# Close tmux popup if any and quit +exit_script () { + tmux display-popup -C + + exit $1 +} + debug () { if [ "$VERBOSE" = true ]; then echo $1 @@ -28,8 +35,7 @@ open_local () { tmux send-keys C-c tmux send-keys "cd $PROJECT_PATH" Enter - # Close tmux popup if any - tmux display-popup -C + exit_script 0 } open_new_pane () { @@ -47,8 +53,7 @@ open_new_pane () { tmux switch-client -t $SESSION_NAME:$PROJECT_NAME - # Close tmux popup if any - tmux display-popup -C + exit_script 0 } update_project_list_cache() { @@ -93,7 +98,7 @@ debug "Selected $SELECTED" # Quit if nothing has been selected if [ ! $SELECTED ]; then - exit 0 + exit_script 1 fi PROJECT_PATH=$(realpath ~/${SELECTED})