diff --git a/.config/bash/module/Tmux.sh b/.config/bash/module/Tmux.sh index 9b5f2de..5060fbe 100644 --- a/.config/bash/module/Tmux.sh +++ b/.config/bash/module/Tmux.sh @@ -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}" diff --git a/.config/bash/module/Util.sh b/.config/bash/module/Util.sh index 79bfa7b..4910879 100644 --- a/.config/bash/module/Util.sh +++ b/.config/bash/module/Util.sh @@ -116,3 +116,8 @@ function _contains() { return 1 } + +# Check if inside Tmux. +function _is_tmux() { + [[ "${TERM_PROGRAM}" = "tmux" ]] +}