tmux sessionizer can attach when no client e attached
This commit is contained in:
parent
44c53d68d0
commit
3852948adf
1 changed files with 14 additions and 8 deletions
|
@ -14,13 +14,19 @@ fi
|
||||||
selected_name=$(basename "$selected" | tr . _)
|
selected_name=$(basename "$selected" | tr . _)
|
||||||
tmux_running=$(pgrep tmux)
|
tmux_running=$(pgrep tmux)
|
||||||
|
|
||||||
if [[ -z $TMUX ]] && [[ -z "$tmux_running" ]]; then
|
|
||||||
tmux new-session -s "$selected_name" -c "$selected"
|
if [[ -z "$tmux_running" ]]; then
|
||||||
exit 0
|
if [[ -z $TMUX ]]; then
|
||||||
|
tmux new-session -s "$selected_name" -c "$selected"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ -z $TMUX ]]; then
|
||||||
|
tmux a
|
||||||
|
fi
|
||||||
|
if ! tmux has-session -t="$selected_name" 2> /dev/null; then
|
||||||
|
tmux new-session -ds "$selected_name" -c "$selected"
|
||||||
|
fi
|
||||||
|
tmux switch-client -t "$selected_name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! tmux has-session -t="$selected_name" 2> /dev/null; then
|
|
||||||
tmux new-session -ds "$selected_name" -c "$selected"
|
|
||||||
fi
|
|
||||||
|
|
||||||
tmux switch-client -t "$selected_name"
|
|
||||||
|
|
Loading…
Reference in a new issue