Util : Add _is_tmux.

This commit is contained in:
Dmitry Voronin 2024-01-23 15:57:39 +03:00
parent b2b937b40f
commit 72cf1056e8
2 changed files with 6 additions and 1 deletions

View file

@ -11,7 +11,7 @@ function ta() {
tmux new-session -s "${name}" -d &> /dev/null
# Attach to session.
if [[ "${TERM_PROGRAM}" = "tmux" ]]; then
if _is_tmux; then
tmux switch-client -t "${name}"
else
tmux attach-session -t "${name}"

View file

@ -116,3 +116,8 @@ function _contains() {
return 1
}
# Check if inside Tmux.
function _is_tmux() {
[[ "${TERM_PROGRAM}" = "tmux" ]]
}