Move append existing session logic to launcher
This commit is contained in:
parent
e95e125151
commit
d272de21c3
3 changed files with 11 additions and 11 deletions
|
|
@ -103,6 +103,16 @@ if [ -n "$SERVER" ] && [ -n "$REMOTE_DIR" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Check if session already exists and attach if it does
|
||||
if is_session_running "$SESSION_NAME"; then
|
||||
printf "\033[1;32mAttaching to existing session: %s\033[0m\n" "$SESSION_NAME"
|
||||
tmux attach-session -t "$SESSION_NAME"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Update papis cache
|
||||
papis cache reset > /dev/null 2>&1
|
||||
|
||||
# Launch appropriate template
|
||||
case "$TEMPLATE" in
|
||||
"basic")
|
||||
|
|
|
|||
|
|
@ -11,11 +11,6 @@ if [ -z "$SESSION_NAME" ] || [ -z "$CODE_PATH" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if tmux has-session -t $SESSION_NAME 2>/dev/null; then
|
||||
tmux attach-session -t $SESSION_NAME
|
||||
exit 0
|
||||
fi
|
||||
|
||||
tmux new-session -d -s $SESSION_NAME -c "$CODE_PATH"
|
||||
tmux rename-window -t $SESSION_NAME:1 "nvim"
|
||||
tmux send-keys -t $SESSION_NAME:1 "nvim" C-m
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@ if [ -z "$SESSION_NAME" ] || [ -z "$CODE_PATH" ] || [ -z "$PAPER_PATH" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if tmux has-session -t $SESSION_NAME 2>/dev/null; then
|
||||
tmux attach-session -t $SESSION_NAME
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Create windows for code
|
||||
tmux new-session -d -s $SESSION_NAME -c "$CODE_PATH"
|
||||
tmux rename-window -t $SESSION_NAME:1 "code"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue