fix tmux bug with related session names

This commit is contained in:
thek4n 2025-05-23 18:03:10 +03:00
parent c3a1612b0f
commit 537e66cf20
6 changed files with 9 additions and 9 deletions

View File

@ -23,4 +23,4 @@ readonly session_to_attach
if [ -n "${session_to_attach}" ]; then
tmux switch-client -t "${session_to_attach}"
fi
fi

View File

@ -28,7 +28,7 @@ fi
session="$(basename "${project_dir}" | sed 's/\./_/g')"
if ! tmux has-session -t "${session}" 2>/dev/null; then
if ! tmux has-session -t="${session}" 2>/dev/null; then
tmux new-session -d -n 1 -c "${project_dir}" -s "$(basename "${project_dir}")"
fi

View File

@ -7,7 +7,7 @@ readonly MAINW=1
readonly WORKING_PROJECT="${HOME}/dotfiles"
if ! tmux has-session -t "${SESSION}"; then
if ! tmux has-session -t="${SESSION}"; then
tmux new-session -s "${SESSION}" -d -n "${MAINW}" -c "${WORKING_PROJECT}"
tmux splitw -t "${SESSION}:${MAINW}" -d -b -h -l "${_tmux_other_pane_size}" -c '#{pane_current_path}'
tmux send-keys -t "${SESSION}:${MAINW}.1" "git pull --rebase && git push" Enter

View File

@ -7,7 +7,7 @@ readonly SESSION=example-background-job
readonly MAINW=1
if tmux has-session -t "${SESSION}" 2>/dev/null; then
if tmux has-session -t="${SESSION}" 2>/dev/null; then
tmux kill-session -t "${SESSION}"
fi
@ -33,4 +33,4 @@ tmux kill-session -t "${SESSION}"
EOF
chmod +x "${temp_script}"
nohup "${temp_script}" >/dev/null & # run in background
nohup "${temp_script}" >/dev/null & # run in background

View File

@ -10,7 +10,7 @@ random() {
readonly SESSION_PREFIX="sandbox"
SESSION="${SESSION_PREFIX}$(random)"
while tmux has-session -t "${SESSION}" 2>/dev/null
while tmux has-session -t="${SESSION}" 2>/dev/null
do
SESSION="${SESSION_PREFIX}$(random)"
done
@ -21,4 +21,4 @@ WORKING_PROJECT="$(mktemp -td "${SESSION}.XXXX")"
readonly WORKING_PROJECT
tmux new-session -s "${SESSION}" -d -c "${WORKING_PROJECT}"
tmux switch-client -t "${SESSION}"
tmux switch-client -t "${SESSION}"

View File

@ -27,8 +27,8 @@ fi
SESSION="ssh_$(echo "${choosed_ssh_server%% *}" | sed 's/\./\-/g ; s/\:/\-/g')"
if ! tmux has-session -t "${SESSION}" 2>/dev/null; then
if ! tmux has-session -t="${SESSION}" 2>/dev/null; then
tmux new-session -s "${SESSION}" -d -n "1" "TERM=xterm-256color ssh ${choosed_ssh_server} || read"
fi
tmux switch-client -t "${SESSION}"
tmux switch-client -t "${SESSION}"