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
|
|
||||||
|
if [[ -z "$tmux_running" ]]; then
|
||||||
|
if [[ -z $TMUX ]]; then
|
||||||
tmux new-session -s "$selected_name" -c "$selected"
|
tmux new-session -s "$selected_name" -c "$selected"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
if [[ -z $TMUX ]]; then
|
||||||
|
tmux a
|
||||||
|
fi
|
||||||
if ! tmux has-session -t="$selected_name" 2> /dev/null; then
|
if ! tmux has-session -t="$selected_name" 2> /dev/null; then
|
||||||
tmux new-session -ds "$selected_name" -c "$selected"
|
tmux new-session -ds "$selected_name" -c "$selected"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux switch-client -t "$selected_name"
|
tmux switch-client -t "$selected_name"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue