diff options
-rw-r--r-- | .zprofile | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -1,8 +1,20 @@ -if tty -s && [[ -z $DISPLAY ]] && type screen &>/dev/null && [[ -e ~/.screenrc-2 ]]; then - screenname=$(screen -list | grep "screen-sh-2") - if [ ! "$screenname" ]; then - exec screen -S "screen-sh-2" -c ~/.screenrc-2 - elif echo $screenname | grep -q "Detached"; then - exec screen -r screen-sh-2 +if tty -s && [[ -z $DISPLAY ]]; then + if type tmux &>/dev/null; then + if [[ -z "$TMUX" ]]; then + if ! tmux has -t "autosession"; then + exec tmux new -s "autosession" + else + exec tmux new -t "autosession" + fi + fi + fi + + if type screen &>/dev/null && [[ -e ~/.screenrc-2 ]]; then + screenname=$(screen -list | grep "screen-sh-2") + if [ ! "$screenname" ]; then + exec screen -S "screen-sh-2" -c ~/.screenrc-2 + elif echo $screenname | grep -q "Detached"; then + exec screen -r screen-sh-2 + fi fi fi |