summaryrefslogtreecommitdiffstats
path: root/.zprofile
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-09-30 16:24:50 +0200
committerFlorian Pritz <bluewind@xinu.at>2014-09-30 16:24:50 +0200
commit3de4a9ecda2b892fe14fde65c75fdfd1b82e479c (patch)
tree065785141892b02f90010d44adbe7927a028d43d /.zprofile
parent21881916c4867b5c279a166e18e1cf8746929480 (diff)
downloaddotfiles-3de4a9ecda2b892fe14fde65c75fdfd1b82e479c.tar.gz
dotfiles-3de4a9ecda2b892fe14fde65c75fdfd1b82e479c.tar.xz
zprofile: start tmux if available
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to '.zprofile')
-rw-r--r--.zprofile24
1 files changed, 18 insertions, 6 deletions
diff --git a/.zprofile b/.zprofile
index 7738012..153aee6 100644
--- a/.zprofile
+++ b/.zprofile
@@ -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